From 6591329b0cb5adf3956d03cbce0f09bfa0166bb3 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 26 Apr 2016 13:04:08 -0700 Subject: [PATCH] grab script calls startDistanceGrab and releaseGrab entity methods and sends grab/release messages to Hifi-Object-Manipulation channel --- examples/grab.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/examples/grab.js b/examples/grab.js index 8857b5f611..2134616f89 100644 --- a/examples/grab.js +++ b/examples/grab.js @@ -383,7 +383,16 @@ Grabber.prototype.pressEvent = function(event) { if(!entityIsGrabbedByOther(this.entityID)){ this.moveEvent(event); } - + + var args = "mouse"; + Entities.callEntityMethod(this.entityID, "startDistanceGrab", args); + + Messages.sendMessage('Hifi-Object-Manipulation', JSON.stringify({ + action: 'grab', + grabbedEntity: this.entityID + })); + + // TODO: play sounds again when we aren't leaking AudioInjector threads //Audio.playSound(grabSound, { position: entityProperties.position, volume: VOLUME }); } @@ -401,6 +410,16 @@ Grabber.prototype.releaseEvent = function(event) { beacon.disable(); + var args = "mouse"; + Entities.callEntityMethod(this.entityID, "releaseGrab", args); + + Messages.sendMessage('Hifi-Object-Manipulation', JSON.stringify({ + action: 'release', + grabbedEntity: this.entityID, + joint: "mouse" + })); + + // TODO: play sounds again when we aren't leaking AudioInjector threads //Audio.playSound(releaseSound, { position: entityProperties.position, volume: VOLUME }); }