소스 검색

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);
+
+        }
     }
 }