void DestroyStaticBody() { if (TxNative.ShapeExists(m_shapeID)) { TxNative.DestroyShape(m_shapeID); } Mesh shapeMesh; TerrainData shapeTerrain; Vector3 shapeCenter, shapeSize; int capsuleDirection; switch (DetectCollisionType(out shapeMesh, out shapeTerrain, out shapeCenter, out shapeSize, out capsuleDirection)) { case CollisionType.Mesh: if (TxNative.MeshExists(m_colliderID)) { TxNative.ReleaseMesh(m_colliderID); } break; case CollisionType.Terrain: if (TxNative.TerrainExists(m_colliderID)) { TxNative.ReleaseTerrain(m_colliderID); } break; case CollisionType.Convex: if (TxNative.ConvexExists(m_colliderID)) { TxNative.ReleaseConvex(m_colliderID); } break; case CollisionType.Box: case CollisionType.Capsule: case CollisionType.Sphere: if (TxNative.ConvexExists(m_colliderID)) { TxNative.DestroyConvex(m_colliderID); } break; } for (int i = 0; i < m_matterIDs.Length; ++i) { TxNative.ReleaseMatter(m_matterIDs[i]); } DestroyBody(); }
void DestroyRigidBody() { TxPhysics.onBeforePhysX -= OnBeforePhysX; if (TxNative.ShapeExists(m_shapeID)) { TxNative.DestroyShape(m_shapeID); } for (int i = 0; i < m_matterIDs.Length; ++i) { TxNative.ReleaseMatter(m_matterIDs[i]); } Mesh shapeMesh; Vector3 shapeCenter, shapeSize; int capsuleDirection; switch (DetectCollisionType(out shapeMesh, out shapeCenter, out shapeSize, out capsuleDirection)) { case CollisionType.Mesh: if (TxNative.MeshExists(m_colliderID)) { TxNative.ReleaseMesh(m_colliderID); } break; case CollisionType.Convex: if (TxNative.ConvexExists(m_colliderID)) { TxNative.ReleaseConvex(m_colliderID); } break; case CollisionType.Box: case CollisionType.Capsule: case CollisionType.Sphere: if (TxNative.ConvexExists(m_colliderID)) { TxNative.DestroyConvex(m_colliderID); } break; } DestroyBody(); if (TxNative.RigidExists(m_rigidID)) { TxNative.DestroyRigid(m_rigidID); } }