示例#1
0
	virtual ~RigidObject() 
	{
		if(body->getMotionState())
			delete body->getMotionState();
		world->removeRigidBody(body);
		delete body;
	}
示例#2
0
	virtual ~RigidObject() 
	{
		if(body)
		{
			if(body->getMotionState() != NULL)
				delete body->getMotionState();
	//		if(body->getCollisionShape() != NULL)
	//			delete body->getCollisionShape();
			world->removeRigidBody(body);
			delete body;
		}
	}
示例#3
0
void FractureBody::clear(btDynamicsWorld& world)
{
	for (int i = 0; i < m_connections.size(); ++i)
	{
		btRigidBody* cb = m_connections[i].m_body;
		btAssert(!cb->getCollisionShape()->isCompound());
		if (cb->isInWorld())
		{
			world.removeRigidBody(cb);
		}
		delete cb->getCollisionShape();
		delete cb;
	}
	m_connections.clear();
}
	virtual	~RagDoll ()
	{
		int i;

		// Remove all constraints
		for ( i = 0; i < JOINT_COUNT; ++i)
		{
			m_ownerWorld->removeConstraint(m_joints[i]);
			delete m_joints[i]; m_joints[i] = 0;
		}

		// Remove all bodies and shapes
		for ( i = 0; i < BODYPART_COUNT; ++i)
		{
			m_ownerWorld->removeRigidBody(m_bodies[i]);
			
			delete m_bodies[i]->getMotionState();

			delete m_bodies[i]; m_bodies[i] = 0;
			delete m_shapes[i]; m_shapes[i] = 0;
		}
	}