mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 06:44:06 +02:00
increase action lifetime to be more forgiving of clock skew. remove code that makes avatar a ghost while holding something
This commit is contained in:
parent
b417abc3de
commit
4e057e5ada
1 changed files with 5 additions and 51 deletions
|
@ -66,6 +66,7 @@ var MSEC_PER_SEC = 1000.0;
|
|||
// these control how long an abandoned pointer line will hang around
|
||||
var startTime = Date.now();
|
||||
var LIFETIME = 10;
|
||||
var ACTION_LIFETIME = 120; // 2 minutes
|
||||
|
||||
// states for the state machine
|
||||
var STATE_OFF = 0;
|
||||
|
@ -81,16 +82,6 @@ var STATE_RELEASE = 8;
|
|||
var GRAB_USER_DATA_KEY = "grabKey";
|
||||
var GRABBABLE_DATA_KEY = "grabbableKey";
|
||||
|
||||
// HACK -- until we have collision groups, don't allow held object to collide with avatar
|
||||
var AVATAR_COLLISIONS_MENU_ITEM = "Enable avatar collisions";
|
||||
|
||||
|
||||
// HACK -- until we have collision groups, don't allow held object to collide with avatar
|
||||
var initialAvatarCollisionsMenu = Menu.isOptionChecked(AVATAR_COLLISIONS_MENU_ITEM);
|
||||
var currentAvatarCollisionsMenu = initialAvatarCollisionsMenu;
|
||||
var noCollisionsCount = 0; // how many hands want collisions disabled?
|
||||
|
||||
|
||||
function getTag() {
|
||||
return "grab-" + MyAvatar.sessionUUID;
|
||||
}
|
||||
|
@ -173,28 +164,6 @@ function MyController(hand, triggerAction) {
|
|||
}
|
||||
};
|
||||
|
||||
// HACK -- until we have collision groups, don't allow held object to collide with avatar
|
||||
this.disableAvatarCollisions = function() {
|
||||
noCollisionsCount += 1;
|
||||
if (currentAvatarCollisionsMenu != false) {
|
||||
currentAvatarCollisionsMenu = false;
|
||||
Menu.setIsOptionChecked(AVATAR_COLLISIONS_MENU_ITEM, false);
|
||||
MyAvatar.updateMotionBehaviorFromMenu();
|
||||
}
|
||||
}
|
||||
|
||||
// HACK -- until we have collision groups, don't allow held object to collide with avatar
|
||||
this.revertAvatarCollisions = function() {
|
||||
noCollisionsCount -= 1;
|
||||
if (noCollisionsCount < 1) {
|
||||
if (currentAvatarCollisionsMenu != initialAvatarCollisionsMenu) {
|
||||
currentAvatarCollisionsMenu = initialAvatarCollisionsMenu;
|
||||
Menu.setIsOptionChecked(AVATAR_COLLISIONS_MENU_ITEM, initialAvatarCollisionsMenu);
|
||||
MyAvatar.updateMotionBehaviorFromMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.lineOn = function(closePoint, farPoint, color) {
|
||||
// draw a line
|
||||
if (this.pointer === null) {
|
||||
|
@ -327,9 +296,6 @@ function MyController(hand, triggerAction) {
|
|||
|
||||
this.distanceHolding = function() {
|
||||
|
||||
// HACK -- until we have collision groups, don't allow held object to collide with avatar
|
||||
this.disableAvatarCollisions();
|
||||
|
||||
var handControllerPosition = Controller.getSpatialControlPosition(this.palm);
|
||||
var handRotation = Quat.multiply(MyAvatar.orientation, Controller.getSpatialControlRawRotation(this.palm));
|
||||
var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, ["position", "rotation"]);
|
||||
|
@ -349,7 +315,7 @@ function MyController(hand, triggerAction) {
|
|||
targetRotation: this.currentObjectRotation,
|
||||
angularTimeScale: DISTANCE_HOLDING_ACTION_TIMEFRAME,
|
||||
tag: getTag(),
|
||||
lifetime: 5
|
||||
lifetime: ACTION_LIFETIME
|
||||
});
|
||||
}
|
||||
if (this.actionID === NULL_ACTION_ID) {
|
||||
|
@ -374,9 +340,6 @@ function MyController(hand, triggerAction) {
|
|||
|
||||
this.continueDistanceHolding = function() {
|
||||
if (this.triggerSmoothedReleased()) {
|
||||
// HACK -- until we have collision groups, don't allow held object to collide with avatar
|
||||
this.revertAvatarCollisions();
|
||||
|
||||
this.state = STATE_RELEASE;
|
||||
return;
|
||||
}
|
||||
|
@ -451,19 +414,13 @@ function MyController(hand, triggerAction) {
|
|||
linearTimeScale: DISTANCE_HOLDING_ACTION_TIMEFRAME,
|
||||
targetRotation: this.currentObjectRotation,
|
||||
angularTimeScale: DISTANCE_HOLDING_ACTION_TIMEFRAME,
|
||||
lifetime: 5
|
||||
lifetime: ACTION_LIFETIME
|
||||
});
|
||||
};
|
||||
|
||||
this.nearGrabbing = function() {
|
||||
|
||||
// HACK -- until we have collision groups, don't allow held object to collide with avatar
|
||||
this.disableAvatarCollisions();
|
||||
|
||||
if (this.triggerSmoothedReleased()) {
|
||||
// HACK -- until we have collision groups, don't allow held object to collide with avatar
|
||||
this.revertAvatarCollisions();
|
||||
|
||||
this.state = STATE_RELEASE;
|
||||
return;
|
||||
}
|
||||
|
@ -492,7 +449,7 @@ function MyController(hand, triggerAction) {
|
|||
relativePosition: offsetPosition,
|
||||
relativeRotation: offsetRotation,
|
||||
tag: getTag(),
|
||||
lifetime: 5
|
||||
lifetime: ACTION_LIFETIME
|
||||
});
|
||||
}
|
||||
if (this.actionID === NULL_ACTION_ID) {
|
||||
|
@ -515,9 +472,6 @@ function MyController(hand, triggerAction) {
|
|||
|
||||
this.continueNearGrabbing = function() {
|
||||
if (this.triggerSmoothedReleased()) {
|
||||
// HACK -- until we have collision groups, don't allow held object to collide with avatar
|
||||
this.revertAvatarCollisions();
|
||||
|
||||
this.state = STATE_RELEASE;
|
||||
return;
|
||||
}
|
||||
|
@ -540,7 +494,7 @@ function MyController(hand, triggerAction) {
|
|||
this.currentObjectTime = now;
|
||||
Entities.callEntityMethod(this.grabbedEntity, "continueNearGrab");
|
||||
|
||||
Entities.updateAction(this.grabbedEntity, this.actionID, {lifetime: 5});
|
||||
Entities.updateAction(this.grabbedEntity, this.actionID, {lifetime: ACTION_LIFETIME});
|
||||
};
|
||||
|
||||
this.nearGrabbingNonColliding = function() {
|
||||
|
|
Loading…
Reference in a new issue