diff options
author | Robert Adams | 2014-05-26 20:29:45 -0700 |
---|---|---|
committer | Robert Adams | 2014-05-26 20:29:45 -0700 |
commit | fab0389cb17cd74e47156c58b52dd62b098c8494 (patch) | |
tree | e6bc5096045adb3de6beacc28c76bb1b64912eea /OpenSim/Region/Physics | |
parent | Don't report NPC presences. (diff) | |
download | opensim-SC_OLD-fab0389cb17cd74e47156c58b52dd62b098c8494.zip opensim-SC_OLD-fab0389cb17cd74e47156c58b52dd62b098c8494.tar.gz opensim-SC_OLD-fab0389cb17cd74e47156c58b52dd62b098c8494.tar.bz2 opensim-SC_OLD-fab0389cb17cd74e47156c58b52dd62b098c8494.tar.xz |
BulletSim: add locking of PhysObjects while processing simulation
step updates and collisions. This is an attempt to fix a crash reported
by Justin when doing high velocity teleports.
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 9fa55ce..23bada9 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -639,15 +639,18 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
639 | { | 639 | { |
640 | if (collidersCount > 0) | 640 | if (collidersCount > 0) |
641 | { | 641 | { |
642 | for (int ii = 0; ii < collidersCount; ii++) | 642 | lock (PhysObjects) |
643 | { | 643 | { |
644 | uint cA = m_collisionArray[ii].aID; | 644 | for (int ii = 0; ii < collidersCount; ii++) |
645 | uint cB = m_collisionArray[ii].bID; | 645 | { |
646 | Vector3 point = m_collisionArray[ii].point; | 646 | uint cA = m_collisionArray[ii].aID; |
647 | Vector3 normal = m_collisionArray[ii].normal; | 647 | uint cB = m_collisionArray[ii].bID; |
648 | float penetration = m_collisionArray[ii].penetration; | 648 | Vector3 point = m_collisionArray[ii].point; |
649 | SendCollision(cA, cB, point, normal, penetration); | 649 | Vector3 normal = m_collisionArray[ii].normal; |
650 | SendCollision(cB, cA, point, -normal, penetration); | 650 | float penetration = m_collisionArray[ii].penetration; |
651 | SendCollision(cA, cB, point, normal, penetration); | ||
652 | SendCollision(cB, cA, point, -normal, penetration); | ||
653 | } | ||
651 | } | 654 | } |
652 | } | 655 | } |
653 | } | 656 | } |
@@ -658,14 +661,17 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
658 | { | 661 | { |
659 | if (updatedEntityCount > 0) | 662 | if (updatedEntityCount > 0) |
660 | { | 663 | { |
661 | for (int ii = 0; ii < updatedEntityCount; ii++) | 664 | lock (PhysObjects) |
662 | { | 665 | { |
663 | EntityProperties entprop = m_updateArray[ii]; | 666 | for (int ii = 0; ii < updatedEntityCount; ii++) |
664 | BSPhysObject pobj; | ||
665 | if (PhysObjects.TryGetValue(entprop.ID, out pobj)) | ||
666 | { | 667 | { |
667 | if (pobj.IsInitialized) | 668 | EntityProperties entprop = m_updateArray[ii]; |
668 | pobj.UpdateProperties(entprop); | 669 | BSPhysObject pobj; |
670 | if (PhysObjects.TryGetValue(entprop.ID, out pobj)) | ||
671 | { | ||
672 | if (pobj.IsInitialized) | ||
673 | pobj.UpdateProperties(entprop); | ||
674 | } | ||
669 | } | 675 | } |
670 | } | 676 | } |
671 | } | 677 | } |