From 73bcb8cc9af886baef195c815ac5e8c1dfc2a2b8 Mon Sep 17 00:00:00 2001 From: sunag Date: Wed, 23 May 2018 17:54:54 -0300 Subject: [PATCH] fix getWorldPosition target alert --- examples/js/nodes/utils/VelocityNode.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/js/nodes/utils/VelocityNode.js b/examples/js/nodes/utils/VelocityNode.js index ed699f3f73..5f305a2a18 100644 --- a/examples/js/nodes/utils/VelocityNode.js +++ b/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 ); -- GitLab