diff options
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 59 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 3 |
2 files changed, 45 insertions, 17 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index f2906cf..2cdc988 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -89,6 +89,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
89 | private bool m_alwaysRun = false; | 89 | private bool m_alwaysRun = false; |
90 | private bool m_hackSentFall = false; | 90 | private bool m_hackSentFall = false; |
91 | private bool m_hackSentFly = false; | 91 | private bool m_hackSentFly = false; |
92 | private PhysicsVector m_taintPosition = new PhysicsVector(0, 0, 0); | ||
92 | public uint m_localID = 0; | 93 | public uint m_localID = 0; |
93 | public bool m_returnCollisions = false; | 94 | public bool m_returnCollisions = false; |
94 | // taints and their non-tainted counterparts | 95 | // taints and their non-tainted counterparts |
@@ -130,6 +131,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
130 | _velocity = new PhysicsVector(); | 131 | _velocity = new PhysicsVector(); |
131 | _target_velocity = new PhysicsVector(); | 132 | _target_velocity = new PhysicsVector(); |
132 | _position = pos; | 133 | _position = pos; |
134 | |||
135 | m_taintPosition.X = pos.X; | ||
136 | m_taintPosition.Y = pos.Y; | ||
137 | m_taintPosition.Z = pos.Z; | ||
138 | |||
133 | _acceleration = new PhysicsVector(); | 139 | _acceleration = new PhysicsVector(); |
134 | _parent_scene = parent_scene; | 140 | _parent_scene = parent_scene; |
135 | 141 | ||
@@ -158,10 +164,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
158 | m_isPhysical = false; // current status: no ODE information exists | 164 | m_isPhysical = false; // current status: no ODE information exists |
159 | m_tainted_isPhysical = true; // new tainted status: need to create ODE information | 165 | m_tainted_isPhysical = true; // new tainted status: need to create ODE information |
160 | 166 | ||
161 | lock (_parent_scene.OdeLock) | 167 | |
162 | { | 168 | _parent_scene.AddPhysicsActorTaint(this); |
163 | _parent_scene.AddPhysicsActorTaint(this); | 169 | |
164 | } | ||
165 | m_name = avName; | 170 | m_name = avName; |
166 | } | 171 | } |
167 | 172 | ||
@@ -371,11 +376,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
371 | get { return _position; } | 376 | get { return _position; } |
372 | set | 377 | set |
373 | { | 378 | { |
374 | lock (_parent_scene.OdeLock) | 379 | if (Body == IntPtr.Zero || Shell == IntPtr.Zero) |
375 | { | 380 | _position.X = value.X; _position.Y = value.Y; _position.Z = value.Z; |
376 | d.BodySetPosition(Body, value.X, value.Y, value.Z); | 381 | |
377 | _position = value; | 382 | m_taintPosition.X = value.X; m_taintPosition.Y = value.Y; m_taintPosition.Z = value.Z; |
378 | } | 383 | _parent_scene.AddPhysicsActorTaint(this); |
379 | } | 384 | } |
380 | } | 385 | } |
381 | 386 | ||
@@ -395,14 +400,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
395 | set | 400 | set |
396 | { | 401 | { |
397 | m_pidControllerActive = true; | 402 | m_pidControllerActive = true; |
398 | lock (_parent_scene.OdeLock) | 403 | |
399 | { | ||
400 | PhysicsVector SetSize = value; | 404 | PhysicsVector SetSize = value; |
401 | m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f; | 405 | m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f; |
402 | //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); | 406 | //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); |
403 | 407 | ||
404 | Velocity = new PhysicsVector(0f, 0f, 0f); | 408 | Velocity = new PhysicsVector(0f, 0f, 0f); |
405 | } | 409 | |
406 | _parent_scene.AddPhysicsActorTaint(this); | 410 | _parent_scene.AddPhysicsActorTaint(this); |
407 | } | 411 | } |
408 | } | 412 | } |
@@ -444,6 +448,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
444 | d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH); | 448 | d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH); |
445 | Body = d.BodyCreate(_parent_scene.world); | 449 | Body = d.BodyCreate(_parent_scene.world); |
446 | d.BodySetPosition(Body, npositionX, npositionY, npositionZ); | 450 | d.BodySetPosition(Body, npositionX, npositionY, npositionZ); |
451 | |||
452 | _position.X = npositionX; | ||
453 | _position.Y = npositionY; | ||
454 | _position.Z = npositionZ; | ||
455 | |||
456 | |||
457 | m_taintPosition.X = npositionX; | ||
458 | m_taintPosition.Y = npositionY; | ||
459 | m_taintPosition.Z = npositionZ; | ||
447 | 460 | ||
448 | d.BodySetMass(Body, ref ShellMass); | 461 | d.BodySetMass(Body, ref ShellMass); |
449 | d.Matrix3 m_caprot; | 462 | d.Matrix3 m_caprot; |
@@ -708,6 +721,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
708 | // If the PID Controller isn't active then we set our force | 721 | // If the PID Controller isn't active then we set our force |
709 | // calculating base velocity to the current position | 722 | // calculating base velocity to the current position |
710 | 723 | ||
724 | if (Body == IntPtr.Zero) | ||
725 | return; | ||
711 | 726 | ||
712 | if (m_pidControllerActive == false) | 727 | if (m_pidControllerActive == false) |
713 | { | 728 | { |
@@ -890,11 +905,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
890 | /// </summary> | 905 | /// </summary> |
891 | public void Destroy() | 906 | public void Destroy() |
892 | { | 907 | { |
893 | lock (_parent_scene.OdeLock) | 908 | m_tainted_isPhysical = false; |
894 | { | 909 | _parent_scene.AddPhysicsActorTaint(this); |
895 | m_tainted_isPhysical = false; | ||
896 | _parent_scene.AddPhysicsActorTaint(this); | ||
897 | } | ||
898 | } | 910 | } |
899 | 911 | ||
900 | public override void CrossingFailure() | 912 | public override void CrossingFailure() |
@@ -1005,6 +1017,19 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1005 | + (Amotor==IntPtr.Zero ? "Amotor ":"") ); | 1017 | + (Amotor==IntPtr.Zero ? "Amotor ":"") ); |
1006 | } | 1018 | } |
1007 | } | 1019 | } |
1020 | |||
1021 | if (!m_taintPosition.IsIdentical(_position, 0.05f)) | ||
1022 | { | ||
1023 | if (Body != IntPtr.Zero) | ||
1024 | { | ||
1025 | d.BodySetPosition(Body, m_taintPosition.X, m_taintPosition.Y, m_taintPosition.Z); | ||
1026 | |||
1027 | _position.X = m_taintPosition.X; | ||
1028 | _position.Y = m_taintPosition.Y; | ||
1029 | _position.Z = m_taintPosition.Z; | ||
1030 | } | ||
1031 | } | ||
1032 | |||
1008 | } | 1033 | } |
1009 | } | 1034 | } |
1010 | } | 1035 | } |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index e45bcda..3adabcf 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -1174,6 +1174,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1174 | if (chr == null) | 1174 | if (chr == null) |
1175 | continue; | 1175 | continue; |
1176 | 1176 | ||
1177 | if (chr.Shell == IntPtr.Zero || chr.Body == IntPtr.Zero) | ||
1178 | continue; | ||
1179 | |||
1177 | chr.IsColliding = false; | 1180 | chr.IsColliding = false; |
1178 | chr.CollidingGround = false; | 1181 | chr.CollidingGround = false; |
1179 | chr.CollidingObj = false; | 1182 | chr.CollidingObj = false; |