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
}
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 TRIGGER_CONTROLS = [
@ -168,11 +153,9 @@
var handToDisable = this.initialHand === 'right' ? 'left' : 'right';
Messages.sendMessage('Hifi-Hand-Disabler', handToDisable);
setEntityCustomData('grabbableKey', this.entityID, {
grabbable: false,
invertSolidWhileHeld: true,
spatialKey: BOW_SPATIAL_KEY
});
var data = getEntityCustomData('grabbableKey', this.entityID, {});
data.grabbable = false;
setEntityCustomData('grabbableKey', this.entityID, data);
},
continueNearGrab: function() {
@ -226,11 +209,10 @@
this.isGrabbed = false;
this.stringDrawn = false;
this.deleteStrings();
setEntityCustomData('grabbableKey', this.entityID, {
grabbable: true,
invertSolidWhileHeld: true,
spatialKey: BOW_SPATIAL_KEY
});
var data = getEntityCustomData('grabbableKey', this.entityID, {});
data.grabbable = true;
setEntityCustomData('grabbableKey', this.entityID, data);
Entities.deleteEntity(this.preNotchString);
Entities.deleteEntity(this.arrow);
this.aiming = false;

View file

@ -53,8 +53,13 @@ var wand = Entities.addEntity({
y: 0.1,
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: {
relativePosition: {
x: 0,
y: 0,
z: 0
y: 0.05,
z: -0.08
},
relativeRotation: Quat.fromPitchYawRollDegrees(45, 90, 0)
relativeRotation: Quat.fromPitchYawRollDegrees(90, 90, 0)
},
invertSolidWhileHeld: true
}