From e13fecfd3d465cd51f4d0802b3f2a4d9b2c989b7 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 3 Oct 2016 20:47:30 -0700 Subject: BulletSim: zero velocity target when setting velocity through the SetMomentum method. --- OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs | 12 +++++++++++- OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs index 213f2eb..757f06c 100644 --- a/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs @@ -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 for being below terrain or on water. // 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 { get { return RawTorque; } set { RawTorque = value; diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs index 7c6f213..3682455 100755 --- a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs @@ -625,7 +625,7 @@ public abstract class BSPhysObject : PhysicsActor { CurrentCollisionFlags = PhysScene.PE.AddToCollisionFlags(PhysBody, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); DetailLog("{0},{1}.SubscribeEvents,setting collision. ms={2}, collisionFlags={3:x}", - LocalID, TypeName, ms, CurrentCollisionFlags); + LocalID, TypeName, SubscribedEventsMs, CurrentCollisionFlags); } }); } -- cgit v1.1