From 9df85eadf4b3719a898fda8769313ae023962c25 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 10 Dec 2012 15:35:53 -0800 Subject: BulletSim: Fix crash on the destruction of physical linksets. While fixing the above, add methods to physical body and shape pointer wrapper so routines won't have to know that IntPtr.Zero means no physical instance. Fix problem with physical linksets failing after a few sits and unsits by properly restoring child prom positions for compound linksets after multiple selection and deselections. --- .../Region/Physics/BulletSPlugin/BulletSimAPI.cs | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs index 2671995..1559025 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs @@ -53,6 +53,9 @@ public struct BulletSim // An allocated Bullet btRigidBody public struct BulletBody { + public BulletBody(uint id) : this(id, IntPtr.Zero) + { + } public BulletBody(uint id, IntPtr xx) { ID = id; @@ -64,6 +67,13 @@ public struct BulletBody public uint ID; public CollisionFilterGroups collisionGroup; public CollisionFilterGroups collisionMask; + + public void Clear() + { + ptr = IntPtr.Zero; + } + public bool HasPhysicalBody { get { return ptr != IntPtr.Zero; } } + public override string ToString() { StringBuilder buff = new StringBuilder(); @@ -103,6 +113,13 @@ public struct BulletShape public BSPhysicsShapeType type; public System.UInt64 shapeKey; public bool isNativeShape; + + public void Clear() + { + ptr = IntPtr.Zero; + } + public bool HasPhysicalShape { get { return ptr != IntPtr.Zero; } } + public override string ToString() { StringBuilder buff = new StringBuilder(); @@ -140,6 +157,12 @@ public struct BulletConstraint ptr = xx; } public IntPtr ptr; + + public void Clear() + { + ptr = IntPtr.Zero; + } + public bool HasPhysicalConstraint { get { return ptr != IntPtr.Zero; } } } // An allocated HeightMapThing which holds various heightmap info. -- cgit v1.1