浏览代码

Merge remote-tracking branch 'upstream/master' into libToModules

sebavan 6 年之前
父节点
当前提交
be53204674

+ 5 - 1
dist/preview release/what's new.md

@@ -6,7 +6,7 @@
 - [Inspector v2.0](https://doc.babylonjs.com/features/playground_debuglayer). [Dev log](https://medium.com/@babylonjs/dev-log-creating-the-new-inspector-b15c50900205) ([Deltakosh](https://github.com/deltakosh))
 - Added support for [parallel shader compilation](https://www.khronos.org/registry/webgl/extensions/KHR_parallel_shader_compile/) ([Deltakosh](https://github.com/deltakosh))
 - Added [Object Based Motion Blur](http://doc.babylonjs.com/how_to/using_motionblurpostprocess) post-process ([julien-moreau](https://github.com/julien-moreau))
-- Added [support for AmmoJS](https://doc.babylonjs.com/how_to/using_the_physics_engine) as a physics plugin (Composite objects, joints, motors) ([TrevorDev](https://github.com/TrevorDev))
+- Added [support for AmmoJS](https://doc.babylonjs.com/how_to/using_the_physics_engine) as a physics plugin (Composite objects, motors, joints) ([TrevorDev](https://github.com/TrevorDev))
 - Added support for [WebXR](https://doc.babylonjs.com/how_to/webxr) ([TrevorDev](https://github.com/TrevorDev))
   - Add customAnimationFrameRequester to allow sessions to hook into engine's render loop ([TrevorDev](https://github.com/TrevorDev))
   - camera customDefaultRenderTarget to allow cameras to render to a custom render target (eg. xr framebuffer) instead of the canvas ([TrevorDev](https://github.com/TrevorDev))
@@ -131,6 +131,8 @@
 - Update physics position using absolutePosition instead of pivotPosition ([TrevorDev](https://github.com/TrevorDev))
 - Disable camera arrow key controls when the Command key is selected on Mac OS ([kcoley](https://github.com/kcoley))
 - Viewer should not set receiveShadows on an instanced mesh ([TrevorDev](https://github.com/TrevorDev))
+- Updated comment in TransformNode.rotationQuaternion to include undefined as one of the potential return values ([nathankmiller](https://github.com/nathankmiller)
+- CannonJS ignores connectedPivot joint parameter ([TrevorDev](https://github.com/TrevorDev)))
 
 ### Core Engine
 - Fixed a bug with `mesh.alwaysSelectAsActiveMesh` preventing layerMask to be taken in account ([Deltakosh](https://github.com/deltakosh))
@@ -159,6 +161,8 @@
 
 ### Loaders
 
+- Added missing `loadedAnimationGroups` to `MeshAssetTask` ([bghgary](https://github.com/bghgary))
+
 ## Breaking changes
 
 - `Database.IDBStorageEnabled` is now false by default ([Deltakosh](https://github.com/deltakosh))

+ 1 - 0
readme.md

@@ -7,6 +7,7 @@ Getting started? Play directly with the Babylon.js API using our [playground](ht
 [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/BabylonJS/Babylon.js.svg)](http://isitmaintained.com/project/BabylonJS/Babylon.js "Average time to resolve an issue")
 [![Percentage of issues still open](https://isitmaintained.com/badge/open/babylonJS/babylon.js.svg)](https://isitmaintained.com/project/babylonJS/babylon.js "Percentage of issues still open")
 [![Build Size](https://img.badgesize.io/BabylonJS/Babylon.js/master/dist/preview%20release/babylon.js.svg?compression=gzip)](https://img.badgesize.io/BabylonJS/Babylon.js/master/dist/preview%20release/babylon.js.svg?compression=gzip)
+[![Twitter](https://img.shields.io/twitter/follow/babylonjs.svg?style=social&label=Follow)](https://twitter.com/intent/follow?screen_name=babylonjs)
 
 **Any questions?** Here is our official [forum](https://forum.babylonjs.com/).
 

+ 1 - 1
src/Meshes/transformNode.ts

@@ -166,7 +166,7 @@ import { Bone } from "../Bones/bone";
         }
 
         /**
-         * Gets or sets the rotation Quaternion property : this a Quaternion object defining the node rotation by using a unit quaternion (null by default).
+         * Gets or sets the rotation Quaternion property : this a Quaternion object defining the node rotation by using a unit quaternion (undefined by default, but can be null).
          * If set, only the rotationQuaternion is then used to compute the node rotation (ie. node.rotation will be ignored)
          */
         public get rotationQuaternion(): Nullable<Quaternion> {

+ 6 - 1
src/Misc/assetsManager.ts

@@ -226,6 +226,10 @@ import { Logger } from "../Misc/logger";
          * Gets the list of loaded skeletons
          */
         public loadedSkeletons: Array<Skeleton>;
+        /**
+         * Gets the list of loaded animation groups
+         */
+        public loadedAnimationGroups: Array<AnimationGroup>;
 
         /**
          * Callback called when the task is successful
@@ -272,10 +276,11 @@ import { Logger } from "../Misc/logger";
          */
         public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {
             SceneLoader.ImportMesh(this.meshesNames, this.rootUrl, this.sceneFilename, scene,
-                (meshes: AbstractMesh[], particleSystems: IParticleSystem[], skeletons: Skeleton[]) => {
+                (meshes: AbstractMesh[], particleSystems: IParticleSystem[], skeletons: Skeleton[], animationGroups: AnimationGroup[]) => {
                     this.loadedMeshes = meshes;
                     this.loadedParticleSystems = particleSystems;
                     this.loadedSkeletons = skeletons;
+                    this.loadedAnimationGroups = animationGroups;
                     onSuccess();
                 }, null, (scene, message, exception) => {
                     onError(message, exception);

+ 7 - 4
src/Physics/Plugins/ammoJSPlugin.ts

@@ -272,9 +272,10 @@ import { AbstractMesh } from "../../Meshes/abstractMesh";
                     body.setCollisionFlags(body.getCollisionFlags() | AmmoJSPlugin.DISABLE_COLLISION_FLAG);
                 }
 
-                body.setRestitution(impostor.getParam("restitution"));
                 this.world.addRigidBody(body);
                 impostor.physicsBody = body;
+                this.setBodyRestitution(impostor, impostor.getParam("restitution"));
+                this.setBodyFriction(impostor, impostor.getParam("friction"));
 
                 impostor._pluginData.toDispose.concat([body, rbInfo, myMotionState, startTransform, localInertia, colShape]);
             }
@@ -342,7 +343,7 @@ import { AbstractMesh } from "../../Meshes/abstractMesh";
                     joint = new Ammo.btPoint2PointConstraint(mainBody, connectedBody, new Ammo.btVector3(jointData.mainPivot.x, jointData.mainPivot.y, jointData.mainPivot.z), new Ammo.btVector3(jointData.connectedPivot.x, jointData.connectedPivot.y, jointData.connectedPivot.z));
                     break;
             }
-            this.world.addConstraint(joint, true);
+            this.world.addConstraint(joint, !impostorJoint.joint.jointData.collision);
             impostorJoint.joint.physicsJoint = joint;
         }
 
@@ -620,7 +621,7 @@ import { AbstractMesh } from "../../Meshes/abstractMesh";
          * @returns friction value
          */
         public getBodyFriction(impostor: PhysicsImpostor): number {
-            return impostor.physicsBody.getFriction();
+            return impostor._pluginData.friction;
         }
 
         /**
@@ -630,6 +631,7 @@ import { AbstractMesh } from "../../Meshes/abstractMesh";
          */
         public setBodyFriction(impostor: PhysicsImpostor, friction: number) {
             impostor.physicsBody.setFriction(friction);
+            impostor._pluginData.friction = friction;
         }
 
         /**
@@ -638,7 +640,7 @@ import { AbstractMesh } from "../../Meshes/abstractMesh";
          * @returns restitution value
          */
         public getBodyRestitution(impostor: PhysicsImpostor): number {
-            return impostor.physicsBody.getRestitution();
+            return impostor._pluginData.restitution;
         }
 
         /**
@@ -648,6 +650,7 @@ import { AbstractMesh } from "../../Meshes/abstractMesh";
          */
         public setBodyRestitution(impostor: PhysicsImpostor, restitution: number) {
             impostor.physicsBody.setRestitution(restitution);
+            impostor._pluginData.restitution = restitution;
         }
 
         /**

+ 1 - 1
src/Physics/Plugins/cannonJSPlugin.ts

@@ -204,7 +204,7 @@ import { PhysicsEngine } from "../../Physics/physicsEngine";
                 case PhysicsJoint.PointToPointJoint:
                 case PhysicsJoint.BallAndSocketJoint:
                 default:
-                    constraint = new this.BJSCANNON.PointToPointConstraint(mainBody, constraintData.pivotA, connectedBody, constraintData.pivotA, constraintData.maxForce);
+                    constraint = new this.BJSCANNON.PointToPointConstraint(mainBody, constraintData.pivotA, connectedBody, constraintData.pivotB, constraintData.maxForce);
                     break;
             }
             //set the collideConnected flag after the creation, since DistanceJoint ignores it.