浏览代码

fix getWorldPosition target alert

sunag 7 年之前
父节点
当前提交
73bcb8cc9a
共有 1 个文件被更改,包括 2 次插入2 次删除
  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 ) {
 
-		this.position = target.getWorldPosition();
+		this.position = target.getWorldPosition( this.position || new THREE.Vector3() );
 		this.oldPosition = this.position.clone();
 
 	}
@@ -85,7 +85,7 @@ THREE.VelocityNode.prototype.updateFrameVelocity = function ( frame ) {
 
 	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.oldPosition.copy( this.position );