private void RemoveSoftBody(SoftBody body, SoftBodyCustomData cdata) { this.World.RemoveCollisionObject(body); body.Dispose(); if (this.SoftBodyDeleted != null) { this.SoftBodyDeleted(body, cdata.Id); } }
public void TearDown() { world.RemoveSoftBody(softBody); softBody.Dispose(); softBodyWorldInfo.Dispose(); world.Dispose(); solver.Dispose(); broadphase.Dispose(); dispatcher.Dispose(); conf.Dispose(); }
protected virtual void Dispose(bool isdisposing) { if (isInWorld && isdisposing && m_BSoftBody != null) { if (m_BSoftBody != null) { World.RemoveSoftBody(m_BSoftBody); } } if (m_BSoftBody != null) { //if (m_BSoftBody.MotionState != null) m_BSoftBody.MotionState.Dispose(); m_BSoftBody.Dispose(); m_BSoftBody = null; } Debug.Log("Destroying SoftBody " + name); }
protected override void Dispose(bool isdisposing) { SoftBody m_BSoftBody = (SoftBody)m_collisionObject; if (isInWorld && isdisposing && m_BSoftBody != null) { if (m_BSoftBody != null) { World.RemoveSoftBody(m_BSoftBody); } } if (m_BSoftBody != null) { m_BSoftBody.Dispose(); m_BSoftBody = null; } // Log.Info("Destroying SoftBody " + name); }
public void Destroy() { this.dynamicsWorld.DeleteAndDisposeAllConstraints(); //this.dynamicsWorld.DeleteAndDisposeAllRigidBodies(); for (int i = 0; i < this.dynamicsWorld.NumCollisionObjects; i++) { CollisionObject obj = dynamicsWorld.CollisionObjectArray[i]; if (obj is RigidBody) { RigidBody body = obj as RigidBody; dynamicsWorld.DeleteAndDisposeBody(body); } else if (obj is SoftBody) { SoftBody body = obj as SoftBody; dynamicsWorld.RemoveSoftBody(body); body.Dispose(); body.CollisionShape.Dispose(); body.Tag = null; } } dynamicsWorld.Dispose(); solver.Dispose(); overlappingPairCache.Dispose(); dispatcher.Dispose(); collisionConfiguration.Dispose(); this.bodyContainer.Clear(); this.softBodyContainer.Clear(); this.constraintContainer.Clear(); this.created = false; }