mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 21:43:03 +02:00
tweak
This commit is contained in:
parent
fcbb107bc0
commit
755b971906
1 changed files with 13 additions and 4 deletions
|
@ -339,11 +339,12 @@ function MyController(hand, triggerAction) {
|
||||||
var handRotation = Quat.multiply(MyAvatar.orientation, Controller.getSpatialControlRawRotation(this.palm));
|
var handRotation = Quat.multiply(MyAvatar.orientation, Controller.getSpatialControlRawRotation(this.palm));
|
||||||
var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, ["position", "rotation",
|
var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, ["position", "rotation",
|
||||||
"gravity", "ignoreForCollisions"]);
|
"gravity", "ignoreForCollisions"]);
|
||||||
|
var now = Date.now();
|
||||||
|
|
||||||
// add the action and initialize some variables
|
// add the action and initialize some variables
|
||||||
this.currentObjectPosition = grabbedProperties.position;
|
this.currentObjectPosition = grabbedProperties.position;
|
||||||
this.currentObjectRotation = grabbedProperties.rotation;
|
this.currentObjectRotation = grabbedProperties.rotation;
|
||||||
this.currentObjectTime = Date.now();
|
this.currentObjectTime = now;
|
||||||
this.handPreviousPosition = handControllerPosition;
|
this.handPreviousPosition = handControllerPosition;
|
||||||
this.handPreviousRotation = handRotation;
|
this.handPreviousRotation = handRotation;
|
||||||
|
|
||||||
|
@ -359,6 +360,7 @@ function MyController(hand, triggerAction) {
|
||||||
if (this.actionID === NULL_ACTION_ID) {
|
if (this.actionID === NULL_ACTION_ID) {
|
||||||
this.actionID = null;
|
this.actionID = null;
|
||||||
}
|
}
|
||||||
|
this.actionTimeout = now + (ACTION_LIFETIME * MSEC_PER_SEC);
|
||||||
|
|
||||||
if (this.actionID !== null) {
|
if (this.actionID !== null) {
|
||||||
this.setState(STATE_CONTINUE_DISTANCE_HOLDING);
|
this.setState(STATE_CONTINUE_DISTANCE_HOLDING);
|
||||||
|
@ -454,9 +456,11 @@ function MyController(hand, triggerAction) {
|
||||||
angularTimeScale: DISTANCE_HOLDING_ACTION_TIMEFRAME,
|
angularTimeScale: DISTANCE_HOLDING_ACTION_TIMEFRAME,
|
||||||
lifetime: ACTION_LIFETIME
|
lifetime: ACTION_LIFETIME
|
||||||
});
|
});
|
||||||
|
this.actionTimeout = now + (ACTION_LIFETIME * MSEC_PER_SEC);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.nearGrabbing = function() {
|
this.nearGrabbing = function() {
|
||||||
|
var now = Date.now();
|
||||||
|
|
||||||
if (this.triggerSmoothedReleased()) {
|
if (this.triggerSmoothedReleased()) {
|
||||||
this.setState(STATE_RELEASE);
|
this.setState(STATE_RELEASE);
|
||||||
|
@ -490,6 +494,7 @@ function MyController(hand, triggerAction) {
|
||||||
if (this.actionID === NULL_ACTION_ID) {
|
if (this.actionID === NULL_ACTION_ID) {
|
||||||
this.actionID = null;
|
this.actionID = null;
|
||||||
} else {
|
} else {
|
||||||
|
this.actionTimeout = now + (ACTION_LIFETIME * MSEC_PER_SEC);
|
||||||
this.setState(STATE_CONTINUE_NEAR_GRABBING);
|
this.setState(STATE_CONTINUE_NEAR_GRABBING);
|
||||||
if (this.hand === RIGHT_HAND) {
|
if (this.hand === RIGHT_HAND) {
|
||||||
Entities.callEntityMethod(this.grabbedEntity, "setRightHand");
|
Entities.callEntityMethod(this.grabbedEntity, "setRightHand");
|
||||||
|
@ -529,9 +534,13 @@ function MyController(hand, triggerAction) {
|
||||||
this.currentObjectTime = now;
|
this.currentObjectTime = now;
|
||||||
Entities.callEntityMethod(this.grabbedEntity, "continueNearGrab");
|
Entities.callEntityMethod(this.grabbedEntity, "continueNearGrab");
|
||||||
|
|
||||||
Entities.updateAction(this.grabbedEntity, this.actionID, {
|
if (this.actionTimeout - now < MSEC_PER_SEC) {
|
||||||
lifetime: ACTION_LIFETIME
|
// if less than a second left, refresh the actions lifetime
|
||||||
});
|
Entities.updateAction(this.grabbedEntity, this.actionID, {
|
||||||
|
lifetime: ACTION_LIFETIME
|
||||||
|
});
|
||||||
|
this.actionTimeout = now + (ACTION_LIFETIME * MSEC_PER_SEC);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.nearGrabbingNonColliding = function() {
|
this.nearGrabbingNonColliding = function() {
|
||||||
|
|
Loading…
Reference in a new issue