Browse Source

Merge pull request #681 from dad72/patch-3

add function getFrontPosition
David Catuhe 10 years ago
parent
commit
8e78be7b71
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/Cameras/babylon.camera.ts

+ 8 - 1
src/Cameras/babylon.camera.ts

@@ -450,6 +450,13 @@
             Matrix.OrthoOffCenterLHToRef(this.orthoLeft || -halfWidth, this.orthoRight || halfWidth, this.orthoBottom || -halfHeight, this.orthoTop || halfHeight, this.minZ, this.maxZ, this._projectionMatrix);
             return this._projectionMatrix;
         }
+        
+        public getFrontPosition(num: num): void {
+	        var dir = this.getTarget().subtract(this.position);
+	        dir.normalize();
+	        dir.scaleInPlace(num);		
+	        return this.position.add(dir);
+        }
 
         public dispose(): void {
             // Remove from scene
@@ -584,4 +591,4 @@
             }
         }
     }
-}
+}