浏览代码

Merge pull request #681 from dad72/patch-3

add function getFrontPosition
David Catuhe 10 年之前
父节点
当前提交
8e78be7b71
共有 1 个文件被更改,包括 8 次插入1 次删除
  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 @@
             }
         }
     }
-}
+}