Преглед изворни кода

Merge pull request #1520 from abow/spotlight_rotation

added Spotlight.getRotation
David Catuhe пре 8 година
родитељ
комит
2be1a63193
1 измењених фајлова са 11 додато и 0 уклоњено
  1. 11 0
      src/Lights/babylon.spotLight.ts

+ 11 - 0
src/Lights/babylon.spotLight.ts

@@ -118,5 +118,16 @@
         public getTypeID(): number {
             return 2;
         }
+
+        public getRotation(): Vector3 {
+
+            this.direction.normalize();
+
+            var xaxis = BABYLON.Vector3.Cross(this.direction, BABYLON.Axis.Y);
+            var yaxis = BABYLON.Vector3.Cross(xaxis, this.direction);
+
+            return Vector3.RotationFromAxis(xaxis, yaxis, this.direction);
+
+        }
     }
 }