diff --git a/examples/controllers/handControllerGrab.js b/examples/controllers/handControllerGrab.js index a8a95cb4ca..d143df1e83 100644 --- a/examples/controllers/handControllerGrab.js +++ b/examples/controllers/handControllerGrab.js @@ -431,7 +431,7 @@ function MyController(hand, triggerAction) { this.activateEntity(this.grabbedEntity); - var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, ["position", "rotation"]); + var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, ["position", "rotation", "gravity"]); var handRotation = this.getHandRotation(); var handPosition = this.getHandPosition(); @@ -443,6 +443,9 @@ function MyController(hand, triggerAction) { var offset = Vec3.subtract(currentObjectPosition, handPosition); var offsetPosition = Vec3.multiplyQbyV(Quat.inverse(Quat.multiply(handRotation, offsetRotation)), offset); + this.saveGravity = grabbedProperties.gravity; + Entities.editEntity(this.grabbedEntity, {gravity: {x:0, y:0, z:0}}); + this.actionID = NULL_ACTION_ID; this.actionID = Entities.addAction("kinematic-hold", this.grabbedEntity, { hand: this.hand === RIGHT_HAND ? "right" : "left", @@ -472,6 +475,7 @@ function MyController(hand, triggerAction) { this.continueNearGrabbing = function() { if (this.triggerSmoothedReleased()) { this.state = STATE_RELEASE; + Entities.editEntity(this.grabbedEntity, {gravity: this.saveGravity}); return; }