From b102081f2f1dd0a0bc63c9f7d9c9972c7cb2eb38 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 30 Oct 2015 11:35:51 -0700 Subject: [PATCH] upon release, set velocity after returning entity to being dynamic --- examples/controllers/handControllerGrab.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/controllers/handControllerGrab.js b/examples/controllers/handControllerGrab.js index 9ee9ed1e04..353e7b3daa 100644 --- a/examples/controllers/handControllerGrab.js +++ b/examples/controllers/handControllerGrab.js @@ -588,7 +588,8 @@ function MyController(hand, triggerAction) { relativePosition: this.offsetPosition, relativeRotation: this.offsetRotation, ttl: ACTION_TTL, - kinematic: NEAR_GRABBING_KINEMATIC + kinematic: NEAR_GRABBING_KINEMATIC, + kinematicSetVelocity: true }); if (this.actionID === NULL_ACTION_ID) { this.actionID = null; @@ -641,7 +642,8 @@ function MyController(hand, triggerAction) { relativePosition: this.offsetPosition, relativeRotation: this.offsetRotation, ttl: ACTION_TTL, - kinematic: NEAR_GRABBING_KINEMATIC + kinematic: NEAR_GRABBING_KINEMATIC, + kinematicSetVelocity: true }); this.actionTimeout = now + (ACTION_TTL * MSEC_PER_SEC); } @@ -810,12 +812,13 @@ function MyController(hand, triggerAction) { Entities.callEntityMethod(this.grabbedEntity, "releaseGrab"); } + this.deactivateEntity(this.grabbedEntity); + // the action will tend to quickly bring an object's velocity to zero. now that // the action is gone, set the objects velocity to something the holder might expect. Entities.editEntity(this.grabbedEntity, { velocity: this.grabbedVelocity }); - this.deactivateEntity(this.grabbedEntity); this.grabbedVelocity = ZERO_VEC; this.grabbedEntity = null;