BulletSim: tweeks to make avatar jump work better.
parent
a356978c79
commit
2b53f08386
|
@ -204,7 +204,7 @@ public sealed class BSCharacter : BSPhysObject
|
||||||
// move. Thus, the velocity cannot be forced to zero. The problem is that small velocity
|
// 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.
|
// 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
|
// 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.
|
// The code below keeps setting the velocity to zero hoping the world will keep pushing.
|
||||||
|
|
||||||
_velocityMotor.Step(timeStep);
|
_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.
|
// 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)
|
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);
|
// 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.
|
// just assign to "Position" because of potential call loops.
|
||||||
PhysicsScene.TaintedObject(inTaintTime, "BSCharacter.PositionSanityCheck", delegate()
|
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;
|
ForcePosition = _position;
|
||||||
});
|
});
|
||||||
ret = true;
|
ret = true;
|
||||||
|
@ -572,7 +574,7 @@ public sealed class BSCharacter : BSPhysObject
|
||||||
m_targetVelocity = value;
|
m_targetVelocity = value;
|
||||||
OMV.Vector3 targetVel = value;
|
OMV.Vector3 targetVel = value;
|
||||||
if (_setAlwaysRun)
|
if (_setAlwaysRun)
|
||||||
targetVel *= BSParam.AvatarAlwaysRunFactor;
|
targetVel *= new OMV.Vector3(BSParam.AvatarAlwaysRunFactor, BSParam.AvatarAlwaysRunFactor, 0f);
|
||||||
|
|
||||||
PhysicsScene.TaintedObject("BSCharacter.setTargetVelocity", delegate()
|
PhysicsScene.TaintedObject("BSCharacter.setTargetVelocity", delegate()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue