Fix all entities using relative grab pos/rot

This commit is contained in:
Atlante45 2015-12-08 11:21:04 -08:00
parent 4ee5bf316a
commit 17daff920c
3 changed files with 17 additions and 30 deletions

View file

@ -66,21 +66,6 @@
max2: 15 max2: 15
} }
var BOW_SPATIAL_KEY = {
leftRelativePosition: {
x: -0.02,
y: 0.08,
z: 0.09
},
rightRelativePosition: {
x: 0.02,
y: 0.08,
z: 0.09
},
relativeRotation: Quat.fromPitchYawRollDegrees(0, 90, -90)
}
var USE_DEBOUNCE = false; var USE_DEBOUNCE = false;
var TRIGGER_CONTROLS = [ var TRIGGER_CONTROLS = [
@ -168,11 +153,9 @@
var handToDisable = this.initialHand === 'right' ? 'left' : 'right'; var handToDisable = this.initialHand === 'right' ? 'left' : 'right';
Messages.sendMessage('Hifi-Hand-Disabler', handToDisable); Messages.sendMessage('Hifi-Hand-Disabler', handToDisable);
setEntityCustomData('grabbableKey', this.entityID, { var data = getEntityCustomData('grabbableKey', this.entityID, {});
grabbable: false, data.grabbable = false;
invertSolidWhileHeld: true, setEntityCustomData('grabbableKey', this.entityID, data);
spatialKey: BOW_SPATIAL_KEY
});
}, },
continueNearGrab: function() { continueNearGrab: function() {
@ -226,11 +209,10 @@
this.isGrabbed = false; this.isGrabbed = false;
this.stringDrawn = false; this.stringDrawn = false;
this.deleteStrings(); this.deleteStrings();
setEntityCustomData('grabbableKey', this.entityID, {
grabbable: true, var data = getEntityCustomData('grabbableKey', this.entityID, {});
invertSolidWhileHeld: true, data.grabbable = true;
spatialKey: BOW_SPATIAL_KEY setEntityCustomData('grabbableKey', this.entityID, data);
});
Entities.deleteEntity(this.preNotchString); Entities.deleteEntity(this.preNotchString);
Entities.deleteEntity(this.arrow); Entities.deleteEntity(this.arrow);
this.aiming = false; this.aiming = false;

View file

@ -53,8 +53,13 @@ var wand = Entities.addEntity({
y: 0.1, y: 0.1,
z: 0 z: 0
}, },
relativeRotation: Quat.fromPitchYawRollDegrees(0, 0, 90) relativeRotation: Quat.fromPitchYawRollDegrees(0, 0, -90)
} }
} }
}) })
}); });
function scriptEnding() {
Entities.deleteEntity(wand);
}
Script.scriptEnding.connect(scriptEnding);

View file

@ -28,10 +28,10 @@ var pistol = Entities.addEntity({
spatialKey: { spatialKey: {
relativePosition: { relativePosition: {
x: 0, x: 0,
y: 0, y: 0.05,
z: 0 z: -0.08
}, },
relativeRotation: Quat.fromPitchYawRollDegrees(45, 90, 0) relativeRotation: Quat.fromPitchYawRollDegrees(90, 90, 0)
}, },
invertSolidWhileHeld: true invertSolidWhileHeld: true
} }