public void OnDestroy() { Physics.RemoveRigidBody(rigidBodyObject); _Shape.Dispose(); gameObject = null; _Shape = null; }
public virtual void Dispose() { if (BtShape != null) { BtShape.Dispose(); } }
public void Dispose() { for (int i = this._DynamicsWorld.NumCollisionObjects - 1; i >= 0; --i) { CollisionObject obj = this._DynamicsWorld.CollisionObjectArray[i]; var body = RigidBody.Upcast(obj); if (body != null && body.MotionState != null) { body.MotionState.Dispose(); } this._DynamicsWorld.RemoveCollisionObject(obj); obj.Dispose(); } for (int i = 0; i < this._CollisionShapes.Count(); ++i) { CollisionShape collisionShape = this._CollisionShapes[i]; this._CollisionShapes[i] = null; collisionShape.Dispose(); } this._CollisionShapes.Clear(); }
public void Dispose() { int i; // Remove all constraints for (i = 0; i < JointCount; ++i) { _ownerWorld.RemoveConstraint(Joints[i]); Joints[i].Dispose(); Joints[i] = null; } // Remove all bodies and shapes for (i = 0; i < JointCount; ++i) { _ownerWorld.RemoveRigidBody(_jointBodies[i]); _jointBodies[i].MotionState.Dispose(); _jointBodies[i].Dispose(); } _jointBodies = null; _thighShape.Dispose(); _thighShape = null; _shinShape.Dispose(); _shinShape = null; }
public void TearDown() { _context.Dispose(); _ghostPairCallback.Dispose(); _shape.Dispose(); _ghostObject.Dispose(); }
private void RebuildFrustum(bool culling) { lock (PhysicsSimulation.Locker) { var ghost = _frustumGhost; if (ghost != null) { World?.Physics?.World.RemoveCollisionObject(ghost); _frustumGhost.Dispose(); _frustumShape.Dispose(); } if (!culling) { return; } MakeFrustumCollisionShape(out _frustumShape); _frustumGhost = new GhostObject { CollisionShape = _frustumShape, CollisionFlags = CollisionFlags.NoContactResponse }; World?.Physics?.World.AddCollisionObject(_frustumGhost); } }
protected virtual void Dispose(bool isdisposing) { if (collisionShapePtr != null) { collisionShapePtr.Dispose(); collisionShapePtr = null; } }
public void Dispose() { RenderCallback.Dispose(); _staticObject.Dispose(); _staticShape.Dispose(); this.StandardCleanup(); }
public void TearDown() { _context.Dispose(); _shape.Dispose(); _body1.Dispose(); _body2.Dispose(); _body3.Dispose(); }
//Base Dispose Method protected virtual void Dispose(bool disposing) { if (Shape == null) { return; } Shape.Dispose(); Shape = null; }
public void TearDown() { _world.Dispose(); _solver.Dispose(); _broadphase.Dispose(); _dispatcher.Dispose(); _conf.Dispose(); _shape.Dispose(); _body1.Dispose(); _body2.Dispose(); }
public void TearDown() { _world.Dispose(); _dispatcher.Dispose(); _broadphase.Dispose(); _conf.Dispose(); _callback.Dispose(); _shape.Dispose(); _sphere1.Dispose(); _sphere2.Dispose(); }
public void Dispose() { foreach (var leg in Legs) { _world.RemoveConstraint(leg.Hip); leg.Hip.Dispose(); _world.RemoveConstraint(leg.Knee); leg.Knee.Dispose(); } DisposeRigidBody(_bodyObject); foreach (var leg in Legs) { DisposeRigidBody(leg.Thigh); DisposeRigidBody(leg.Shin); } _bodyShape.Dispose(); _thighShape.Dispose(); _shinShape.Dispose(); }
/// <summary> /// リソースを開放する /// </summary> public void Dispose() { for (int i = dynamicsWorld.NumCollisionObjects - 1; i >= 0; --i) { CollisionObject obj = dynamicsWorld.CollisionObjectArray[i]; RigidBody body = RigidBody.Upcast(obj); if (body != null && body.MotionState != null) { body.MotionState.Dispose(); } dynamicsWorld.RemoveCollisionObject(obj); obj.Dispose(); } for (int i = 0; i < collisionShapes.Count; ++i) { CollisionShape collisionShape = collisionShapes[i]; collisionShapes[i] = null; collisionShape.Dispose(); } collisionShapes.Dispose(); }
public override void OnEnd() { _shape?.Dispose(); _shape = null; }
protected void RemoveCollisionShape(CollisionShape shape) { m_collisionShapes.Remove(shape); shape.Dispose(); }
public override void ExitPhysics() { if (m_inverseModel != null) { Debug.Log("Dispose inverse model " + m_inverseModel.NumBodies); m_inverseModel.Dispose(); } Debug.Log("InverseDynamicsExitPhysics"); //cleanup in the reverse order of creation/initialization //remove the rigidbodies from the dynamics world and delete them if (m_dynamicsWorld == null) { int i; for (i = m_dynamicsWorld.NumConstraints - 1; i >= 0; i--) { TypedConstraint tc = m_dynamicsWorld.GetConstraint(i); m_dynamicsWorld.RemoveConstraint(tc); tc.Dispose(); } for (i = m_dynamicsWorld.NumMultiBodyConstraints - 1; i >= 0; i--) { MultiBodyConstraint mbc = m_dynamicsWorld.GetMultiBodyConstraint(i); m_dynamicsWorld.RemoveMultiBodyConstraint(mbc); mbc.Dispose(); } for (i = m_dynamicsWorld.NumMultibodies - 1; i >= 0; i--) { MultiBody mb = m_dynamicsWorld.GetMultiBody(i); m_dynamicsWorld.RemoveMultiBody(mb); mb.Dispose(); } for (i = m_dynamicsWorld.NumCollisionObjects - 1; i >= 0; i--) { CollisionObject obj = m_dynamicsWorld.CollisionObjectArray[i]; RigidBody body = RigidBody.Upcast(obj); if (body != null && body.MotionState != null) { body.MotionState.Dispose(); } m_dynamicsWorld.RemoveCollisionObject(obj); obj.Dispose(); } } if (m_multiBody != null) { m_multiBody.Dispose(); } //delete collision shapes for (int j = 0; j < CollisionShapes.Count; j++) { CollisionShape shape = CollisionShapes[j]; shape.Dispose(); } CollisionShapes.Clear(); m_dynamicsWorld.Dispose(); m_dynamicsWorld = null; m_solver.Dispose(); m_solver = null; Broadphase.Dispose(); Broadphase = null; Dispatcher.Dispose(); Dispatcher = null; m_pairCache.Dispose(); m_pairCache = null; CollisionConf.Dispose(); CollisionConf = null; Debug.Log("After dispose B"); }