Parcourir la source

fix getWorldPosition target alert

sunag il y a 7 ans
Parent
commit
73bcb8cc9a
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      examples/js/nodes/utils/VelocityNode.js

+ 2 - 2
examples/js/nodes/utils/VelocityNode.js

@@ -74,7 +74,7 @@ THREE.VelocityNode.prototype.setTarget = function ( target ) {
 
 
 	if ( target ) {
 	if ( target ) {
 
 
-		this.position = target.getWorldPosition();
+		this.position = target.getWorldPosition( this.position || new THREE.Vector3() );
 		this.oldPosition = this.position.clone();
 		this.oldPosition = this.position.clone();
 
 
 	}
 	}
@@ -85,7 +85,7 @@ THREE.VelocityNode.prototype.updateFrameVelocity = function ( frame ) {
 
 
 	if ( this.target ) {
 	if ( this.target ) {
 
 
-		this.position = this.target.getWorldPosition();
+		this.position = this.target.getWorldPosition( this.position || new THREE.Vector3() );
 		this.velocity.subVectors( this.position, this.oldPosition );
 		this.velocity.subVectors( this.position, this.oldPosition );
 		this.oldPosition.copy( this.position );
 		this.oldPosition.copy( this.position );