From 32dbbbdc8fa98cb5a6e4c7ecb603f59a0eceda6a Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Thu, 7 May 2015 21:44:09 -0700 Subject: [PATCH] normalize a vector that needed it. Correct rolloff of grab force --- examples/grab.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/grab.js b/examples/grab.js index 5d2ae13cde..312d21dd43 100644 --- a/examples/grab.js +++ b/examples/grab.js @@ -179,7 +179,7 @@ function update(deltaTime) { if (distanceToTarget > CLOSE_ENOUGH) { // compute current velocity in the direction we want to move velocityTowardTarget = Vec3.dot(currentVelocity, Vec3.normalize(dPosition)); - velocityTowardTarget = Vec3.multiply(dPosition, velocityTowardTarget); + velocityTowardTarget = Vec3.multiply(Vec3.normalize(dPosition), velocityTowardTarget); // compute the speed we would like to be going toward the target position desiredVelocity = Vec3.multiply(dPosition, (1.0 / deltaTime) * SPRING_RATE);