Merge pull request #10133 from sethalves/fix-teleport-which-something-equipped

Fix teleport when something equipped
This commit is contained in:
Anthony Thibault 2017-04-09 19:00:21 -07:00 committed by GitHub
commit 746b7aadbd

View file

@ -1094,7 +1094,6 @@ function MyController(hand) {
this.grabbedOverlay = null;
this.state = STATE_OFF;
this.pointer = null; // entity-id of line object
this.entityActivated = false;
this.triggerValue = 0; // rolling average of trigger value
this.triggerClicked = false;
@ -2826,12 +2825,6 @@ function MyController(hand) {
Controller.triggerHapticPulse(HAPTIC_PULSE_STRENGTH, HAPTIC_PULSE_DURATION, this.hand);
if (this.entityActivated) {
var saveGrabbedID = this.grabbedThingID;
this.release();
this.grabbedThingID = saveGrabbedID;
}
var grabbedProperties;
if (this.grabbedIsOverlay) {
grabbedProperties = {
@ -3007,22 +3000,25 @@ function MyController(hand) {
* is called correctly, as these just freshly created entity may not have completely initialized.
*/
var grabEquipCheck = function () {
if (_this.state == STATE_NEAR_GRABBING) {
_this.callEntityMethodOnGrabbed("startNearGrab");
if (_this.state == STATE_NEAR_GRABBING) {
_this.callEntityMethodOnGrabbed("startNearGrab");
} else { // this.state == STATE_HOLD
_this.callEntityMethodOnGrabbed("startEquip");
_this.callEntityMethodOnGrabbed("startEquip");
}
_this.currentHandControllerTipPosition =
(_this.hand === RIGHT_HAND) ? MyAvatar.rightHandTipPosition : MyAvatar.leftHandTipPosition;
_this.currentObjectTime = Date.now();
// don't block teleport raypick with equipped entity
Messages.sendMessage('Hifi-Teleport-Ignore-Add', _this.grabbedThingID);
_this.currentObjectPosition = grabbedProperties.position;
_this.currentObjectRotation = grabbedProperties.rotation;
_this.currentVelocity = ZERO_VEC;
_this.currentAngularVelocity = ZERO_VEC;
_this.currentHandControllerTipPosition =
(_this.hand === RIGHT_HAND) ? MyAvatar.rightHandTipPosition : MyAvatar.leftHandTipPosition;
_this.currentObjectTime = Date.now();
_this.prevDropDetected = false;
_this.currentObjectPosition = grabbedProperties.position;
_this.currentObjectRotation = grabbedProperties.rotation;
_this.currentVelocity = ZERO_VEC;
_this.currentAngularVelocity = ZERO_VEC;
_this.prevDropDetected = false;
}
if (isClone) {
@ -3654,6 +3650,9 @@ function MyController(hand) {
this.turnOffVisualizations();
if (this.grabbedThingID !== null) {
Messages.sendMessage('Hifi-Teleport-Ignore-Remove', this.grabbedThingID);
if (this.state === STATE_HOLD) {
this.callEntityMethodOnGrabbed("releaseEquip");
}