diff options
Diffstat (limited to 'OpenSim')
4 files changed, 35 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs index 8dfb01c..3bd81d4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs | |||
@@ -725,6 +725,13 @@ public override bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj) | |||
725 | return BSAPICPP.RemoveObjectFromWorld2(worldu.ptr, bodyu.ptr); | 725 | return BSAPICPP.RemoveObjectFromWorld2(worldu.ptr, bodyu.ptr); |
726 | } | 726 | } |
727 | 727 | ||
728 | public override bool ClearCollisionProxyCache(BulletWorld world, BulletBody obj) | ||
729 | { | ||
730 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
731 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | ||
732 | return BSAPICPP.ClearCollisionProxyCache2(worldu.ptr, bodyu.ptr); | ||
733 | } | ||
734 | |||
728 | public override bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects) | 735 | public override bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects) |
729 | { | 736 | { |
730 | BulletWorldUnman worldu = world as BulletWorldUnman; | 737 | BulletWorldUnman worldu = world as BulletWorldUnman; |
@@ -1713,6 +1720,9 @@ public static extern bool AddObjectToWorld2(IntPtr world, IntPtr obj); | |||
1713 | public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj); | 1720 | public static extern bool RemoveObjectFromWorld2(IntPtr world, IntPtr obj); |
1714 | 1721 | ||
1715 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1722 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
1723 | public static extern bool ClearCollisionProxyCache2(IntPtr world, IntPtr obj); | ||
1724 | |||
1725 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1716 | public static extern bool AddConstraintToWorld2(IntPtr world, IntPtr constrain, bool disableCollisionsBetweenLinkedObjects); | 1726 | public static extern bool AddConstraintToWorld2(IntPtr world, IntPtr constrain, bool disableCollisionsBetweenLinkedObjects); |
1717 | 1727 | ||
1718 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1728 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs index ff2b497..17ebed2 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs | |||
@@ -169,6 +169,19 @@ private sealed class BulletConstraintXNA : BulletConstraint | |||
169 | return true; | 169 | return true; |
170 | } | 170 | } |
171 | 171 | ||
172 | public override bool ClearCollisionProxyCache(BulletWorld pWorld, BulletBody pBody) | ||
173 | { | ||
174 | DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world; | ||
175 | RigidBody body = ((BulletBodyXNA)pBody).rigidBody; | ||
176 | CollisionObject collisionObject = ((BulletBodyXNA)pBody).body; | ||
177 | if (body != null && collisionObject != null && collisionObject.GetBroadphaseHandle() != null) | ||
178 | { | ||
179 | world.RemoveCollisionObject(collisionObject); | ||
180 | world.AddCollisionObject(collisionObject); | ||
181 | } | ||
182 | return true; | ||
183 | } | ||
184 | |||
172 | public override bool AddConstraintToWorld(BulletWorld pWorld, BulletConstraint pConstraint, bool pDisableCollisionsBetweenLinkedObjects) | 185 | public override bool AddConstraintToWorld(BulletWorld pWorld, BulletConstraint pConstraint, bool pDisableCollisionsBetweenLinkedObjects) |
173 | { | 186 | { |
174 | DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world; | 187 | DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs index 0b3f467..f7dd158 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs | |||
@@ -498,6 +498,8 @@ public abstract bool AddObjectToWorld(BulletWorld world, BulletBody obj); | |||
498 | 498 | ||
499 | public abstract bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj); | 499 | public abstract bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj); |
500 | 500 | ||
501 | public abstract bool ClearCollisionProxyCache(BulletWorld world, BulletBody obj); | ||
502 | |||
501 | public abstract bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects); | 503 | public abstract bool AddConstraintToWorld(BulletWorld world, BulletConstraint constrain, bool disableCollisionsBetweenLinkedObjects); |
502 | 504 | ||
503 | public abstract bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain); | 505 | public abstract bool RemoveConstraintFromWorld(BulletWorld world, BulletConstraint constrain); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index 2efb1a5..47df611 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | |||
@@ -300,8 +300,16 @@ public abstract class BSPhysObject : PhysicsActor | |||
300 | // Called in taint-time!! | 300 | // Called in taint-time!! |
301 | public void ActivateIfPhysical(bool forceIt) | 301 | public void ActivateIfPhysical(bool forceIt) |
302 | { | 302 | { |
303 | if (IsPhysical && PhysBody.HasPhysicalBody) | 303 | if (PhysBody.HasPhysicalBody) |
304 | PhysScene.PE.Activate(PhysBody, forceIt); | 304 | { |
305 | // Clear the collision cache since we've changed some properties. | ||
306 | PhysScene.PE.ClearCollisionProxyCache(PhysScene.World, PhysBody); | ||
307 | if (IsPhysical) | ||
308 | { | ||
309 | // Physical objects might need activating | ||
310 | PhysScene.PE.Activate(PhysBody, forceIt); | ||
311 | } | ||
312 | } | ||
305 | } | 313 | } |
306 | 314 | ||
307 | // 'actors' act on the physical object to change or constrain its motion. These can range from | 315 | // 'actors' act on the physical object to change or constrain its motion. These can range from |