Quellcode durchsuchen

Fix linkToMesh with TransformNode

David Catuhe vor 6 Jahren
Ursprung
Commit
f8d2898fc4

+ 5 - 0
dist/preview release/babylon.d.ts

@@ -1235,6 +1235,7 @@ declare module BABYLON {
          */
         z: number;
         private static _UpReadOnly;
+        private static _ZeroReadOnly;
         /**
          * Creates a new Vector3 object from the given x, y, z (floats) coordinates.
          * @param x defines the first coordinates (on X axis)
@@ -1659,6 +1660,10 @@ declare module BABYLON {
          */
         static readonly UpReadOnly: DeepImmutable<Vector3>;
         /**
+         * Gets a zero Vector3 that must not be updated
+         */
+        static readonly ZeroReadOnly: DeepImmutable<Vector3>;
+        /**
          * Returns a new Vector3 set to (0.0, -1.0, 0.0)
          * @returns a new down Vector3
          */

Datei-Diff unterdrückt, da er zu groß ist
+ 2 - 2
dist/preview release/babylon.js


Datei-Diff unterdrückt, da er zu groß ist
+ 91 - 80
dist/preview release/babylon.max.js


Datei-Diff unterdrückt, da er zu groß ist
+ 1 - 1
dist/preview release/babylon.max.js.map


+ 10 - 0
dist/preview release/babylon.module.d.ts

@@ -1237,6 +1237,7 @@ declare module "babylonjs/Maths/math" {
          */
         z: number;
         private static _UpReadOnly;
+        private static _ZeroReadOnly;
         /**
          * Creates a new Vector3 object from the given x, y, z (floats) coordinates.
          * @param x defines the first coordinates (on X axis)
@@ -1661,6 +1662,10 @@ declare module "babylonjs/Maths/math" {
          */
         static readonly UpReadOnly: DeepImmutable<Vector3>;
         /**
+         * Gets a zero Vector3 that must not be updated
+         */
+        static readonly ZeroReadOnly: DeepImmutable<Vector3>;
+        /**
          * Returns a new Vector3 set to (0.0, -1.0, 0.0)
          * @returns a new down Vector3
          */
@@ -61641,6 +61646,7 @@ declare module BABYLON {
          */
         z: number;
         private static _UpReadOnly;
+        private static _ZeroReadOnly;
         /**
          * Creates a new Vector3 object from the given x, y, z (floats) coordinates.
          * @param x defines the first coordinates (on X axis)
@@ -62065,6 +62071,10 @@ declare module BABYLON {
          */
         static readonly UpReadOnly: DeepImmutable<Vector3>;
         /**
+         * Gets a zero Vector3 that must not be updated
+         */
+        static readonly ZeroReadOnly: DeepImmutable<Vector3>;
+        /**
          * Returns a new Vector3 set to (0.0, -1.0, 0.0)
          * @returns a new down Vector3
          */

+ 1 - 1
gui/src/2D/advancedDynamicTexture.ts

@@ -515,7 +515,7 @@ export class AdvancedDynamicTexture extends DynamicTexture {
                     });
                     continue;
                 }
-                var position = mesh.getBoundingInfo ? mesh.getBoundingInfo().boundingSphere.center : mesh.getAbsolutePosition();
+                var position = mesh.getBoundingInfo ? mesh.getBoundingInfo().boundingSphere.center : (Vector3.ZeroReadOnly() as Vector3);
                 var projectedPosition = Vector3.Project(position, mesh.getWorldMatrix(), scene.getTransformMatrix(), globalViewport);
                 if (projectedPosition.z < 0 || projectedPosition.z > 1) {
                     control.notRenderable = true;

+ 8 - 0
src/Maths/math.ts

@@ -1645,6 +1645,7 @@ export class Vector2 {
  */
 export class Vector3 {
     private static _UpReadOnly = Vector3.Up() as DeepImmutable<Vector3>;
+    private static _ZeroReadOnly = Vector3.Zero() as DeepImmutable<Vector3>;
 
     /**
      * Creates a new Vector3 object from the given x, y, z (floats) coordinates.
@@ -2364,6 +2365,13 @@ export class Vector3 {
     }
 
     /**
+     * Gets a zero Vector3 that must not be updated
+     */
+    public static get ZeroReadOnly(): DeepImmutable<Vector3> {
+        return Vector3._ZeroReadOnly;
+    }
+
+    /**
      * Returns a new Vector3 set to (0.0, -1.0, 0.0)
      * @returns a new down Vector3
      */