mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 20:31:29 +02:00
back to ignore more recent 3 frames. don't have released entities collide with myAvatar until 0.25 seconds after release
This commit is contained in:
parent
0d0e0925e5
commit
84c5bef487
2 changed files with 30 additions and 12 deletions
|
@ -222,22 +222,20 @@ void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) {
|
||||||
// of the most recent.
|
// of the most recent.
|
||||||
//
|
//
|
||||||
// if _measuredLinearVelocitiesIndex is
|
// if _measuredLinearVelocitiesIndex is
|
||||||
// 0 -- ignore i of 4 5
|
// 0 -- ignore i of 3 4 5
|
||||||
// 1 -- ignore i of 5 0
|
// 1 -- ignore i of 4 5 0
|
||||||
// 2 -- ignore i of 0 1
|
// 2 -- ignore i of 5 0 1
|
||||||
// 3 -- ignore i of 1 2
|
// 3 -- ignore i of 0 1 2
|
||||||
// 4 -- ignore i of 2 3
|
// 4 -- ignore i of 1 2 3
|
||||||
// 5 -- ignore i of 3 4
|
// 5 -- ignore i of 2 3 4
|
||||||
if ((i + 1) % 6 == _measuredLinearVelocitiesIndex ||
|
if ((i + 1) % 6 == _measuredLinearVelocitiesIndex ||
|
||||||
(i + 2) % 6 == _measuredLinearVelocitiesIndex) {
|
(i + 2) % 6 == _measuredLinearVelocitiesIndex ||
|
||||||
|
(i + 3) % 6 == _measuredLinearVelocitiesIndex) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
measuredLinearVelocity += _measuredLinearVelocities[i];
|
measuredLinearVelocity += _measuredLinearVelocities[i];
|
||||||
}
|
}
|
||||||
measuredLinearVelocity /= (float)(AvatarActionHold::velocitySmoothFrames - 2);
|
measuredLinearVelocity /= (float)(AvatarActionHold::velocitySmoothFrames - 3);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (_kinematicSetVelocity) {
|
if (_kinematicSetVelocity) {
|
||||||
// rigidBody->setLinearVelocity(glmToBullet(_linearVelocityTarget));
|
// rigidBody->setLinearVelocity(glmToBullet(_linearVelocityTarget));
|
||||||
|
|
|
@ -33,6 +33,8 @@ var TRIGGER_ON_VALUE = 0.4; // Squeezed just enough to activate search or near
|
||||||
var TRIGGER_GRAB_VALUE = 0.85; // Squeezed far enough to complete distant grab
|
var TRIGGER_GRAB_VALUE = 0.85; // Squeezed far enough to complete distant grab
|
||||||
var TRIGGER_OFF_VALUE = 0.15;
|
var TRIGGER_OFF_VALUE = 0.15;
|
||||||
|
|
||||||
|
var COLLIDE_WITH_AV_AFTER_RELEASE_DELAY = 0.25; // seconds
|
||||||
|
|
||||||
var BUMPER_ON_VALUE = 0.5;
|
var BUMPER_ON_VALUE = 0.5;
|
||||||
|
|
||||||
var THUMB_ON_VALUE = 0.5;
|
var THUMB_ON_VALUE = 0.5;
|
||||||
|
@ -263,6 +265,17 @@ function propsArePhysical(props) {
|
||||||
return isPhysical;
|
return isPhysical;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function removeMyAvatarFromCollidesWith(origCollidesWith) {
|
||||||
|
var collidesWithSplit = origCollidesWith.split(",");
|
||||||
|
// remove myAvatar from the array
|
||||||
|
for (var i = collidesWithSplit.length - 1; i >= 0; i--) {
|
||||||
|
if (collidesWithSplit[i] === "myAvatar") {
|
||||||
|
collidesWithSplit.splice(i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return collidesWithSplit.join();
|
||||||
|
}
|
||||||
|
|
||||||
// If another script is managing the reticle (as is done by HandControllerPointer), we should not be setting it here,
|
// If another script is managing the reticle (as is done by HandControllerPointer), we should not be setting it here,
|
||||||
// and we should not be showing lasers when someone else is using the Reticle to indicate a 2D minor mode.
|
// and we should not be showing lasers when someone else is using the Reticle to indicate a 2D minor mode.
|
||||||
var EXTERNALLY_MANAGED_2D_MINOR_MODE = true;
|
var EXTERNALLY_MANAGED_2D_MINOR_MODE = true;
|
||||||
|
@ -2128,13 +2141,20 @@ function MyController(hand) {
|
||||||
if (data["refCount"] < 1) {
|
if (data["refCount"] < 1) {
|
||||||
deactiveProps = {
|
deactiveProps = {
|
||||||
gravity: data["gravity"],
|
gravity: data["gravity"],
|
||||||
collidesWith: data["collidesWith"],
|
// don't set collidesWith back right away, because thrown things tend to bounce off the
|
||||||
|
// avatar's capsule.
|
||||||
|
collidesWith: removeMyAvatarFromCollidesWith(data["collidesWith"]),
|
||||||
collisionless: data["collisionless"],
|
collisionless: data["collisionless"],
|
||||||
dynamic: data["dynamic"],
|
dynamic: data["dynamic"],
|
||||||
parentID: data["parentID"],
|
parentID: data["parentID"],
|
||||||
parentJointIndex: data["parentJointIndex"]
|
parentJointIndex: data["parentJointIndex"]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Script.setTimeout(function () {
|
||||||
|
// set collidesWith back to original value a bit later than the rest
|
||||||
|
Entities.editEntity(entityID, { collidesWith: data["collidesWith"] });
|
||||||
|
}, COLLIDE_WITH_AV_AFTER_RELEASE_DELAY);
|
||||||
|
|
||||||
// things that are held by parenting and dropped with no velocity will end up as "static" in bullet. If
|
// things that are held by parenting and dropped with no velocity will end up as "static" in bullet. If
|
||||||
// it looks like the dropped thing should fall, give it a little velocity.
|
// it looks like the dropped thing should fall, give it a little velocity.
|
||||||
var props = Entities.getEntityProperties(entityID, ["parentID", "velocity", "dynamic", "shapeType"]);
|
var props = Entities.getEntityProperties(entityID, ["parentID", "velocity", "dynamic", "shapeType"]);
|
||||||
|
|
Loading…
Reference in a new issue