Quellcode durchsuchen

Merge pull request #1555 from abow/master

Added world space option to setPivotPoint and updated What's New
David Catuhe vor 8 Jahren
Ursprung
Commit
4bcfb8ee00
2 geänderte Dateien mit 26 neuen und 4 gelöschten Zeilen
  1. 12 2
      dist/preview release/what's new.md
  2. 14 2
      src/Mesh/babylon.abstractMesh.ts

+ 12 - 2
dist/preview release/what's new.md

@@ -16,11 +16,18 @@
 - Added `Effect.GetVertexShaderSource()` and `Effect.GetFragmentShaderSource()` ([deltakosh](https://github.com/deltakosh))
 - Added `Effect.GetVertexShaderSource()` and `Effect.GetFragmentShaderSource()` ([deltakosh](https://github.com/deltakosh))
 - New `Texture.LoadFromDataString()` to help loading base64 encoded textures ([deltakosh](https://github.com/deltakosh))
 - New `Texture.LoadFromDataString()` to help loading base64 encoded textures ([deltakosh](https://github.com/deltakosh))
 - Added Engine detection of the compresed texture formats supported by Hw / browser.  You can specify those formats you have files for using `Engine.setTextureFormatToUse()`, and an appropriate one will be chosen. ([Palmer-JC](https://github.com/Palmer-JC/))
 - Added Engine detection of the compresed texture formats supported by Hw / browser.  You can specify those formats you have files for using `Engine.setTextureFormatToUse()`, and an appropriate one will be chosen. ([Palmer-JC](https://github.com/Palmer-JC/))
+- Added Ray.intersectsMesh, Ray.show, Ray.hide ([abow](https://github.com/abow))
+- Added AbstractMesh.setPivotPoint, AbstractMesh.getPivotPoint, AbstractMesh.getAbsolutePivotPoint ([abow](https://github.com/abow))
+- Added Debug.AxesViewer and Debug.BoneAxesViewer ([abow](https://github.com/abow))
+- Added Bone.getAbsolutePositionFromLocal ([abow](https://github.com/abow))
+- Added Bone.setRotation, Bone.getRotation, Bone.setRotationQuaternion, Bone.getRotationQuaternion ([abow](https://github.com/abow))
 - Added Bone.getAbsolutePosition and Bone.getAbsolutePositionToRef ([abow](https://github.com/abow))
 - Added Bone.getAbsolutePosition and Bone.getAbsolutePositionToRef ([abow](https://github.com/abow))
-- Added Bone.setYawPitchRoll ([abow](https://github.com/abow))
+- Added Bone.translate, Bone.setPosition, Bone.setAbsolutePosition ([abow](https://github.com/abow))
+- Added Bone.setYawPitchRoll, Bone.setRotationMatrix, Bone.setScale, Bone.setAxisAngle ([abow](https://github.com/abow))
 - Added Bone.rotate ([abow](https://github.com/abow))
 - Added Bone.rotate ([abow](https://github.com/abow))
 - Added Bone.scale ([abow](https://github.com/abow))
 - Added Bone.scale ([abow](https://github.com/abow))
-- Added Node.getDirection ([abow](https://github.com/abow))
+- Added Camera.getDirection, AbstractMesh.getDirection, Bone.getDirection ([abow](https://github.com/abow))
+- Added subdivisionsX, subdivisionsY option to GroundMesh ([abow](https://github.com/abow))
 - New ```Tools.CreateScreenshot``` function will capture all canvas data. Previous implementation is now called `CreateScreenshotUsingRenderTarget` ([deltakosh](https://github.com/deltakosh)) 
 - New ```Tools.CreateScreenshot``` function will capture all canvas data. Previous implementation is now called `CreateScreenshotUsingRenderTarget` ([deltakosh](https://github.com/deltakosh)) 
 - Cube textures are now cached by texture cache ([deltakosh](https://github.com/deltakosh)) 
 - Cube textures are now cached by texture cache ([deltakosh](https://github.com/deltakosh)) 
 - Added onAnimationEnd callback for `sprite.playAnimation` ([deltakosh](https://github.com/deltakosh)) 
 - Added onAnimationEnd callback for `sprite.playAnimation` ([deltakosh](https://github.com/deltakosh)) 
@@ -52,6 +59,9 @@ Usefull if a mesh has multiple animations. ([agallouin](https://github.com/AGall
 ### API doc
 ### API doc
 
 
 ### Bug fixes
 ### Bug fixes
+- Fixed issue with SkeletonViewer not displaying correctly with meshes that have a PoseMatrix ([abow](https://github.com/abow))
+- Fixed issue with Quaternion.toEulerAnglesToRef ([abow](https://github.com/abow))
+- Fixed issue with Animatable.goToFrame ([abow](https://github.com/abow))
 - Fixed issue with instancse and viewports ([deltakosh](https://github.com/deltakosh))
 - Fixed issue with instancse and viewports ([deltakosh](https://github.com/deltakosh))
 - Fixed issue with FreeCamera not working in fullscreen or when pointer locked ([abow](https://github.com/abow))
 - Fixed issue with FreeCamera not working in fullscreen or when pointer locked ([abow](https://github.com/abow))
 - MapTexture: Font Characters are now correctly aligned on Chrome ([nockawa](https://github.com/nockawa))
 - MapTexture: Font Characters are now correctly aligned on Chrome ([nockawa](https://github.com/nockawa))

+ 14 - 2
src/Mesh/babylon.abstractMesh.ts

@@ -1219,9 +1219,21 @@
             Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);
             Vector3.TransformNormalToRef(localAxis, this.getWorldMatrix(), result);
         }
         }
 
 
-        public setPivotPoint(point:Vector3): void{
+        public setPivotPoint(point:Vector3, space:Space = Space.LOCAL): void{
 
 
-            Vector3.TransformCoordinatesToRef(point, this.getWorldMatrix(), this.position);
+            if(this.getScene().getRenderId() == 0){
+                this.computeWorldMatrix(true);
+            }
+
+            var wm = this.getWorldMatrix();
+            
+            if (space == Space.WORLD) {
+                var tmat = Tmp.Matrix[0];
+                wm.invertToRef(tmat);
+                point = Vector3.TransformCoordinates(point, tmat);
+            }
+
+            Vector3.TransformCoordinatesToRef(point, wm, this.position);
 
 
             this._pivotMatrix.m[12] = -point.x;
             this._pivotMatrix.m[12] = -point.x;
             this._pivotMatrix.m[13] = -point.y;
             this._pivotMatrix.m[13] = -point.y;