Jelajahi Sumber

removing references to `camera` global

replacing with `this`

pyrotechnick 14 tahun lalu
induk
melakukan
5fc7b02d25
1 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 2 2
      src/cameras/Camera.js

+ 2 - 2
src/cameras/Camera.js

@@ -15,7 +15,7 @@ THREE.Camera = function ( fov, aspect, near, far ) {
 
 	this.translateX = function ( amount ) {
 
-		var vector = camera.target.position.clone().subSelf( camera.position ).normalize().multiplyScalar( amount );
+		var vector = this.target.position.clone().subSelf( this.position ).normalize().multiplyScalar( amount );
 		vector.cross( vector.clone(), this.up );
 
 		this.position.addSelf( vector );
@@ -31,7 +31,7 @@ THREE.Camera = function ( fov, aspect, near, far ) {
 
 	this.translateZ = function ( amount ) {
 
-		var vector = camera.target.position.clone().subSelf( camera.position ).normalize().multiplyScalar( amount );
+		var vector = this.target.position.clone().subSelf( this.position ).normalize().multiplyScalar( amount );
 
 		this.position.subSelf( vector );
 		this.target.position.subSelf( vector );