diff options
author | Teravus Ovares | 2008-02-17 20:04:28 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-02-17 20:04:28 +0000 |
commit | f80a534eb0002eb8bd129affd36584c66bbd1de6 (patch) | |
tree | 166fffb5b965f77ae75962853683ada94a8df37d /OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |
parent | * Disabling physical prim crossings until they get a bit more stable. (diff) | |
download | opensim-SC-f80a534eb0002eb8bd129affd36584c66bbd1de6.zip opensim-SC-f80a534eb0002eb8bd129affd36584c66bbd1de6.tar.gz opensim-SC-f80a534eb0002eb8bd129affd36584c66bbd1de6.tar.bz2 opensim-SC-f80a534eb0002eb8bd129affd36584c66bbd1de6.tar.xz |
* Various ODE Cleanups
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index d28e464..312fd9c 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -672,9 +672,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
672 | } | 672 | } |
673 | ode.dlock(_parent_scene.world); | 673 | ode.dlock(_parent_scene.world); |
674 | m_disabled = true; | 674 | m_disabled = true; |
675 | if (Body != (IntPtr) 0) | 675 | if (Body != (IntPtr)0) |
676 | { | ||
676 | d.BodyDisable(Body); | 677 | d.BodyDisable(Body); |
677 | 678 | Body = (IntPtr)0; | |
679 | } | ||
678 | ode.dunlock(_parent_scene.world); | 680 | ode.dunlock(_parent_scene.world); |
679 | 681 | ||
680 | m_taintdisable = false; | 682 | m_taintdisable = false; |
@@ -682,27 +684,30 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
682 | 684 | ||
683 | public void changePhysicsStatus(float timestap) | 685 | public void changePhysicsStatus(float timestap) |
684 | { | 686 | { |
685 | while (ode.lockquery()) | 687 | lock (ode) |
686 | { | 688 | { |
687 | } | 689 | while (ode.lockquery()) |
688 | ode.dlock(_parent_scene.world); | 690 | { |
691 | } | ||
692 | ode.dlock(_parent_scene.world); | ||
689 | 693 | ||
690 | if (m_isphysical == true) | 694 | if (m_isphysical == true) |
691 | { | ||
692 | if (Body == (IntPtr) 0) | ||
693 | { | 695 | { |
694 | enableBody(); | 696 | if (Body == (IntPtr)0) |
697 | { | ||
698 | enableBody(); | ||
699 | } | ||
695 | } | 700 | } |
696 | } | 701 | else |
697 | else | ||
698 | { | ||
699 | if (Body != (IntPtr) 0) | ||
700 | { | 702 | { |
701 | disableBody(); | 703 | if (Body != (IntPtr)0) |
704 | { | ||
705 | disableBody(); | ||
706 | } | ||
702 | } | 707 | } |
703 | } | ||
704 | 708 | ||
705 | ode.dunlock(_parent_scene.world); | 709 | ode.dunlock(_parent_scene.world); |
710 | } | ||
706 | 711 | ||
707 | resetCollisionAccounting(); | 712 | resetCollisionAccounting(); |
708 | m_taintPhysics = m_isphysical; | 713 | m_taintPhysics = m_isphysical; |
@@ -1279,18 +1284,21 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1279 | 1284 | ||
1280 | 1285 | ||
1281 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) | 1286 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) |
1282 | //if (vec.X < 0.0f) vec.X = 0.0f; | 1287 | //if (vec.X < 0.0f) { vec.X = 0.0f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } |
1283 | //if (vec.Y < 0.0f) vec.Y = 0.0f; | 1288 | //if (vec.Y < 0.0f) { vec.Y = 0.0f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } |
1284 | //if (vec.X > 255.95f) vec.X = 255.95f; | 1289 | //if (vec.X > 255.95f) { vec.X = 255.95f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } |
1285 | //if (vec.Y > 255.95f) vec.Y = 255.95f; | 1290 | //if (vec.Y > 255.95f) { vec.Y = 255.95f; if (Body != (IntPtr)0) d.BodySetAngularVel(Body, 0, 0, 0); } |
1291 | |||
1286 | m_lastposition = _position; | 1292 | m_lastposition = _position; |
1287 | 1293 | ||
1288 | l_position.X = vec.X; | 1294 | l_position.X = vec.X; |
1289 | l_position.Y = vec.Y; | 1295 | l_position.Y = vec.Y; |
1290 | l_position.Z = vec.Z; | 1296 | l_position.Z = vec.Z; |
1291 | 1297 | ||
1292 | //if (l_position.X > 257f || l_position.X < -1f || l_position.Y > 257f || l_position.Y < -1f) | 1298 | if (l_position.X > 255.95f || l_position.X < 0f || l_position.Y > 255.95f || l_position.Y < 0f) |
1293 | //{ | 1299 | { |
1300 | base.RaiseOutOfBounds(_position); | ||
1301 | } | ||
1294 | //if (m_crossingfailures < 5) | 1302 | //if (m_crossingfailures < 5) |
1295 | //{ | 1303 | //{ |
1296 | //base.RequestPhysicsterseUpdate(); | 1304 | //base.RequestPhysicsterseUpdate(); |
@@ -1385,6 +1393,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1385 | m_lastUpdateSent = false; | 1393 | m_lastUpdateSent = false; |
1386 | if (!m_throttleUpdates || throttleCounter > 15) | 1394 | if (!m_throttleUpdates || throttleCounter > 15) |
1387 | { | 1395 | { |
1396 | |||
1388 | base.RequestPhysicsterseUpdate(); | 1397 | base.RequestPhysicsterseUpdate(); |
1389 | } | 1398 | } |
1390 | else | 1399 | else |