BulletSim: tweeks to make avatar jump work better.

user_profiles
Robert Adams 2013-02-25 21:58:00 -08:00
parent a356978c79
commit 2b53f08386
1 changed files with 6 additions and 4 deletions

View File

@ -204,7 +204,7 @@ public sealed class BSCharacter : BSPhysObject
// move. Thus, the velocity cannot be forced to zero. The problem is that small velocity
// errors can creap in and the avatar will slowly float off in some direction.
// So, the problem is that, when an avatar is standing, we cannot tell creaping error
// from real pushing.OMV.Vector3.Zero;
// from real pushing.
// The code below keeps setting the velocity to zero hoping the world will keep pushing.
_velocityMotor.Step(timeStep);
@ -254,9 +254,11 @@ public sealed class BSCharacter : BSPhysObject
}
// If falling, we keep the world's downward vector no matter what the other axis specify.
// The check for _velocity.Z < 0 makes jumping work (temporary upward force).
if (!Flying && !IsColliding)
{
stepVelocity.Z = _velocity.Z;
if (_velocity.Z < 0)
stepVelocity.Z = _velocity.Z;
// DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity);
}
@ -512,7 +514,7 @@ public sealed class BSCharacter : BSPhysObject
// just assign to "Position" because of potential call loops.
PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate()
{
DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation);
DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation);
ForcePosition = _position;
});
ret = true;
@ -572,7 +574,7 @@ public sealed class BSCharacter : BSPhysObject
m_targetVelocity = value;
OMV.Vector3 targetVel = value;
if (_setAlwaysRun)
targetVel *= BSParam.AvatarAlwaysRunFactor;
targetVel *= new OMV.Vector3(BSParam.AvatarAlwaysRunFactor, BSParam.AvatarAlwaysRunFactor, 0f);
PhysicsScene.TaintedObject("BSCharacter.setTargetVelocity", delegate()
{