Merge pull request #9127 from huffman/fix/hand-controller-grab-release

Fix 'releaseGrab' not being called when using grip buttons
This commit is contained in:
Chris Collins 2016-12-01 09:58:36 -08:00 committed by GitHub
commit c0a0a16ff8

View file

@ -2047,8 +2047,6 @@ function MyController(hand) {
}
if (dropDetected && !this.waitForTriggerRelease && this.triggerSmoothedGrab()) {
this.callEntityMethodOnGrabbed("releaseEquip");
// store the offset attach points into preferences.
if (USE_ATTACH_POINT_SETTINGS && this.grabbedHotspot && this.grabbedEntity) {
var prefprops = Entities.getEntityProperties(this.grabbedEntity, ["localPosition", "localRotation"]);
@ -2344,6 +2342,9 @@ function MyController(hand) {
var noVelocity = false;
if (this.grabbedEntity !== null) {
if (this.state === STATE_HOLD) {
this.callEntityMethodOnGrabbed("releaseEquip");
}
// Make a small release haptic pulse if we really were holding something
Controller.triggerHapticPulse(HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, this.hand);