diff options
author | Robert Adams | 2013-04-07 14:05:35 -0700 |
---|---|---|
committer | Robert Adams | 2013-04-08 06:27:44 -0700 |
commit | a7a1b8b7e9269b446e3396a35153b00942c1e35b (patch) | |
tree | df4c7041eb9a2819dd6e17aa2f95768a552f31e3 /OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs | |
parent | BulletSim: complete movement of physical object action code out of the (diff) | |
download | opensim-SC_OLD-a7a1b8b7e9269b446e3396a35153b00942c1e35b.zip opensim-SC_OLD-a7a1b8b7e9269b446e3396a35153b00942c1e35b.tar.gz opensim-SC_OLD-a7a1b8b7e9269b446e3396a35153b00942c1e35b.tar.bz2 opensim-SC_OLD-a7a1b8b7e9269b446e3396a35153b00942c1e35b.tar.xz |
BulletSim: clean up actor code so routines use the same coding pattern.
Fix a few enabling problems.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs | 22 |
1 files changed, 10 insertions, 12 deletions
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 | |||
67 | { | 67 | { |
68 | m_physicsScene.DetailLog("{0},BSActorAvatarMove,refresh", m_controllingPrim.LocalID); | 68 | m_physicsScene.DetailLog("{0},BSActorAvatarMove,refresh", m_controllingPrim.LocalID); |
69 | 69 | ||
70 | // If not active any more, get rid of me (shouldn't ever happen, but just to be safe) | ||
71 | if (m_controllingPrim.RawForce == OMV.Vector3.Zero) | ||
72 | { | ||
73 | m_physicsScene.DetailLog("{0},BSActorAvatarMove,refresh,notAvatarMove,removing={1}", m_controllingPrim.LocalID, ActorName); | ||
74 | m_controllingPrim.PhysicalActors.RemoveAndRelease(ActorName); | ||
75 | return; | ||
76 | } | ||
77 | |||
78 | // If the object is physically active, add the hoverer prestep action | 70 | // If the object is physically active, add the hoverer prestep action |
79 | if (isActive) | 71 | if (isActive) |
80 | { | 72 | { |
@@ -95,14 +87,19 @@ public class BSActorAvatarMove : BSActor | |||
95 | // Nothing to do for the hoverer since it is all software at pre-step action time. | 87 | // Nothing to do for the hoverer since it is all software at pre-step action time. |
96 | } | 88 | } |
97 | 89 | ||
90 | // Usually called when target velocity changes to set the current velocity and the target | ||
91 | // into the movement motor. | ||
98 | public void SetVelocityAndTarget(OMV.Vector3 vel, OMV.Vector3 targ, bool inTaintTime) | 92 | public void SetVelocityAndTarget(OMV.Vector3 vel, OMV.Vector3 targ, bool inTaintTime) |
99 | { | 93 | { |
100 | m_physicsScene.TaintedObject(inTaintTime, "BSActorAvatarMove.setVelocityAndTarget", delegate() | 94 | m_physicsScene.TaintedObject(inTaintTime, "BSActorAvatarMove.setVelocityAndTarget", delegate() |
101 | { | 95 | { |
102 | m_velocityMotor.Reset(); | 96 | if (m_velocityMotor != null) |
103 | m_velocityMotor.SetTarget(targ); | 97 | { |
104 | m_velocityMotor.SetCurrent(vel); | 98 | m_velocityMotor.Reset(); |
105 | m_velocityMotor.Enabled = true; | 99 | m_velocityMotor.SetTarget(targ); |
100 | m_velocityMotor.SetCurrent(vel); | ||
101 | m_velocityMotor.Enabled = true; | ||
102 | } | ||
106 | }); | 103 | }); |
107 | } | 104 | } |
108 | 105 | ||
@@ -119,6 +116,7 @@ public class BSActorAvatarMove : BSActor | |||
119 | 1f // efficiency | 116 | 1f // efficiency |
120 | ); | 117 | ); |
121 | // _velocityMotor.PhysicsScene = PhysicsScene; // DEBUG DEBUG so motor will output detail log messages. | 118 | // _velocityMotor.PhysicsScene = PhysicsScene; // DEBUG DEBUG so motor will output detail log messages. |
119 | SetVelocityAndTarget(m_controllingPrim.RawVelocity, m_controllingPrim.TargetVelocity, true /* inTaintTime */); | ||
122 | 120 | ||
123 | m_physicsScene.BeforeStep += Mover; | 121 | m_physicsScene.BeforeStep += Mover; |
124 | } | 122 | } |