kinematic grab things

This commit is contained in:
James B. Pollack 2015-12-16 14:34:01 -08:00
parent e0b8c6b48b
commit 40a096ca8d
3 changed files with 30 additions and 6 deletions

View file

@ -944,7 +944,7 @@ function MyController(hand) {
relativeRotation: this.offsetRotation, relativeRotation: this.offsetRotation,
ttl: ACTION_TTL, ttl: ACTION_TTL,
kinematic: NEAR_GRABBING_KINEMATIC, kinematic: NEAR_GRABBING_KINEMATIC,
kinematicSetVelocity: false, kinematicSetVelocity: true,
ignoreIK: this.ignoreIK ignoreIK: this.ignoreIK
}); });
if (this.actionID === NULL_ACTION_ID) { if (this.actionID === NULL_ACTION_ID) {
@ -1029,7 +1029,7 @@ function MyController(hand) {
relativeRotation: this.offsetRotation, relativeRotation: this.offsetRotation,
ttl: ACTION_TTL, ttl: ACTION_TTL,
kinematic: NEAR_GRABBING_KINEMATIC, kinematic: NEAR_GRABBING_KINEMATIC,
kinematicSetVelocity: false, kinematicSetVelocity: true,
ignoreIK: this.ignoreIK ignoreIK: this.ignoreIK
}); });
this.actionTimeout = now + (ACTION_TTL * MSEC_PER_SEC); this.actionTimeout = now + (ACTION_TTL * MSEC_PER_SEC);
@ -1243,7 +1243,26 @@ function MyController(hand) {
this.overlayLineOff(); this.overlayLineOff();
if (this.grabbedEntity !== null) { if (this.grabbedEntity !== null) {
if (this.actionID !== null) { if (this.actionID !== null) {
Entities.deleteAction(this.grabbedEntity, this.actionID); //add velocity whatnot
var defaultReleaseVelocityData = {
disableReleaseVelocity: false
};
var releaseVelocityData = getEntityCustomData('releaseVelocityKey', this.grabbedEntity, defaultReleaseVelocityData);
if (releaseVelocityData.disableReleaseVelocity === true) {
Entities.updateAction(this.grabbedEntity, this.actionID, {
ttl: 1,
kinematic: false,
kinematicSetVelocity: false,
});
// Entities.deleteAction(this.grabbedEntity, this.actionID);
} else {
//don't make adjustments
Entities.deleteAction(this.grabbedEntity, this.actionID);
}
} }
} }

View file

@ -243,8 +243,7 @@ entitySlider.prototype = {
axisEnd: this.endOfAxis, axisEnd: this.endOfAxis,
}, },
releaseVelocityKey: { releaseVelocityKey: {
disableReleaseVelocity: true, disableReleaseVelocity: true
customReleaseVelocity: false
} }
}) })
}; };

View file

@ -73,7 +73,13 @@ function createBlock() {
green: 0, green: 0,
blue: 255 blue: 255
}, },
position: position position: position,
userData: JSON.stringify({
releaseVelocityKey: {
disableReleaseVelocity: true
}
})
}; };
block = Entities.addEntity(blockProperties); block = Entities.addEntity(blockProperties);