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.
This commit is contained in:
Robert Adams
2012-12-10 15:35:53 -08:00
parent a19896cc56
commit 9df85eadf4
12 changed files with 155 additions and 38 deletions

View File

@@ -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.