From a7a1b8b7e9269b446e3396a35153b00942c1e35b Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sun, 7 Apr 2013 14:05:35 -0700 Subject: BulletSim: clean up actor code so routines use the same coding pattern. Fix a few enabling problems. --- .../Physics/BulletSPlugin/BSActorAvatarMove.cs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs index 634a898..8416740 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs @@ -67,14 +67,6 @@ public class BSActorAvatarMove : BSActor { m_physicsScene.DetailLog("{0},BSActorAvatarMove,refresh", m_controllingPrim.LocalID); - // If not active any more, get rid of me (shouldn't ever happen, but just to be safe) - if (m_controllingPrim.RawForce == OMV.Vector3.Zero) - { - m_physicsScene.DetailLog("{0},BSActorAvatarMove,refresh,notAvatarMove,removing={1}", m_controllingPrim.LocalID, ActorName); - m_controllingPrim.PhysicalActors.RemoveAndRelease(ActorName); - return; - } - // If the object is physically active, add the hoverer prestep action if (isActive) { @@ -95,14 +87,19 @@ public class BSActorAvatarMove : BSActor // Nothing to do for the hoverer since it is all software at pre-step action time. } + // Usually called when target velocity changes to set the current velocity and the target + // into the movement motor. public void SetVelocityAndTarget(OMV.Vector3 vel, OMV.Vector3 targ, bool inTaintTime) { m_physicsScene.TaintedObject(inTaintTime, "BSActorAvatarMove.setVelocityAndTarget", delegate() { - m_velocityMotor.Reset(); - m_velocityMotor.SetTarget(targ); - m_velocityMotor.SetCurrent(vel); - m_velocityMotor.Enabled = true; + if (m_velocityMotor != null) + { + m_velocityMotor.Reset(); + m_velocityMotor.SetTarget(targ); + m_velocityMotor.SetCurrent(vel); + m_velocityMotor.Enabled = true; + } }); } @@ -119,6 +116,7 @@ public class BSActorAvatarMove : BSActor 1f // efficiency ); // _velocityMotor.PhysicsScene = PhysicsScene; // DEBUG DEBUG so motor will output detail log messages. + SetVelocityAndTarget(m_controllingPrim.RawVelocity, m_controllingPrim.TargetVelocity, true /* inTaintTime */); m_physicsScene.BeforeStep += Mover; } -- cgit v1.1