BulletSim: zero velocity target when setting velocity through the

SetMomentum method.
melanie
Robert Adams 2016-10-03 20:47:30 -07:00
parent f3e7603c37
commit e13fecfd3d
2 changed files with 12 additions and 2 deletions

View File

@ -350,7 +350,6 @@ public sealed class BSCharacter : BSPhysObject
} }
} }
// Check that the current position is sane and, if not, modify the position to make it so. // Check that the current position is sane and, if not, modify the position to make it so.
// Check for being below terrain or on water. // Check for being below terrain or on water.
// Returns 'true' of the position was made sane by some action. // Returns 'true' of the position was made sane by some action.
@ -502,6 +501,17 @@ public sealed class BSCharacter : BSPhysObject
} }
} }
// SetMomentum just sets the velocity without a target. We need to stop the movement actor if a character.
public override void SetMomentum(OMV.Vector3 momentum)
{
if (m_moveActor != null)
{
m_moveActor.SetVelocityAndTarget(OMV.Vector3.Zero, OMV.Vector3.Zero, false /* inTaintTime */);
}
base.SetMomentum(momentum);
}
public override OMV.Vector3 Torque { public override OMV.Vector3 Torque {
get { return RawTorque; } get { return RawTorque; }
set { RawTorque = value; set { RawTorque = value;

View File

@ -625,7 +625,7 @@ public abstract class BSPhysObject : PhysicsActor
{ {
CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
DetailLog("{0},{1}.SubscribeEvents,setting collision. ms={2}, collisionFlags={3:x}", DetailLog("{0},{1}.SubscribeEvents,setting collision. ms={2}, collisionFlags={3:x}",
LocalID, TypeName, ms, CurrentCollisionFlags); LocalID, TypeName, SubscribedEventsMs, CurrentCollisionFlags);
} }
}); });
} }