From 5f2cbfc0fd27198f8f05f4a9a4e2908d8b11752e Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 9 Apr 2013 17:53:18 -0700 Subject: BulletSim: fixing problems with llMoveToTarget. Not all fixed yet. --- OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs | 2 +- .../Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs | 16 +++++++++++----- OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | 6 ++++++ 3 files changed, 18 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs index e8310df..92ace66 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs @@ -50,7 +50,7 @@ public class BSActorHover : BSActor // BSActor.isActive public override bool isActive { - get { return Enabled && m_controllingPrim.IsPhysicallyActive; } + get { return Enabled; } } // Release any connections and resources used by the actor. diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs index 16c2b14..56aacc5 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs @@ -50,7 +50,7 @@ public class BSActorMoveToTarget : BSActor // BSActor.isActive public override bool isActive { - get { return Enabled && m_controllingPrim.IsPhysicallyActive; } + get { return Enabled; } } // Release any connections and resources used by the actor. @@ -65,7 +65,9 @@ public class BSActorMoveToTarget : BSActor // BSActor.Refresh() public override void Refresh() { - m_physicsScene.DetailLog("{0},BSActorMoveToTarget,refresh", m_controllingPrim.LocalID); + m_physicsScene.DetailLog("{0},BSActorMoveToTarget,refresh,enabled={1},active={2},target={3},tau={4}", + m_controllingPrim.LocalID, Enabled, m_controllingPrim.MoveToTargetActive, + m_controllingPrim.MoveToTargetTarget, m_controllingPrim.MoveToTargetTau ); // If not active any more... if (!m_controllingPrim.MoveToTargetActive) @@ -100,7 +102,7 @@ public class BSActorMoveToTarget : BSActor // We're taking over after this. m_controllingPrim.ZeroMotion(true); - m_targetMotor = new BSVMotor("BSPrim.PIDTarget", + m_targetMotor = new BSVMotor("BSActorMoveToTargget.Activate", m_controllingPrim.MoveToTargetTau, // timeScale BSMotor.Infinite, // decay time scale BSMotor.InfiniteVector, // friction timescale @@ -138,15 +140,19 @@ public class BSActorMoveToTarget : BSActor // If we are very close to our target, turn off the movement motor. if (m_targetMotor.ErrorIsZero()) { - m_physicsScene.DetailLog("{0},BSPrim.PIDTarget,zeroMovement,movePos={1},pos={2},mass={3}", + m_physicsScene.DetailLog("{0},BSActorMoveToTarget.Mover,zeroMovement,movePos={1},pos={2},mass={3}", m_controllingPrim.LocalID, movePosition, m_controllingPrim.RawPosition, m_controllingPrim.Mass); m_controllingPrim.ForcePosition = m_targetMotor.TargetValue; + // Setting the position does not cause the physics engine to generate a property update. Force it. + m_physicsScene.PE.PushUpdate(m_controllingPrim.PhysBody); } else { m_controllingPrim.ForcePosition = movePosition; + // Setting the position does not cause the physics engine to generate a property update. Force it. + m_physicsScene.PE.PushUpdate(m_controllingPrim.PhysBody); } - m_physicsScene.DetailLog("{0},BSPrim.PIDTarget,move,fromPos={1},movePos={2}", m_controllingPrim.LocalID, origPosition, movePosition); + m_physicsScene.DetailLog("{0},BSActorMoveToTarget.Mover,move,fromPos={1},movePos={2}", m_controllingPrim.LocalID, origPosition, movePosition); } } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index 64bf395..98eb4ca 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs @@ -295,6 +295,7 @@ public abstract class BSPhysObject : PhysicsActor if (PhysicalActors.TryGetActor(actorName, out theActor)) { // The actor already exists so just turn it on or off + DetailLog("{0},BSPhysObject.EnableActor,enablingExistingActor,name={1},enable={2}", LocalID, actorName, enableActor); theActor.Enabled = enableActor; } else @@ -302,10 +303,15 @@ public abstract class BSPhysObject : PhysicsActor // The actor does not exist. If it should, create it. if (enableActor) { + DetailLog("{0},BSPhysObject.EnableActor,creatingActor,name={1}", LocalID, actorName); theActor = creator(); PhysicalActors.Add(actorName, theActor); theActor.Enabled = true; } + else + { + DetailLog("{0},BSPhysObject.EnableActor,notCreatingActorSinceNotEnabled,name={1}", LocalID, actorName); + } } } } -- cgit v1.1