Ejemplo n.º 1
0
ArticulatedPhysicsEntity::~ArticulatedPhysicsEntity()
{
	SimplePhysicsEntity* entity;
	unsigned entityId;
	unsigned rigidBodyIndex, entityIndex;
	std::map<unsigned, unsigned>::iterator it;

	Physics* physics = (Physics*)SystemCore::getModuleByName("Physics");

	if (physics && articulatedBody->isAddedToSimulation())
		physics->removePhysicsObject(this);

	// Clear rigidBody-Pointer in SimplePhysicsEntity
	for (it = rigidBodyMapping.begin(); it != rigidBodyMapping.end(); ++it)
	{
		rigidBodyIndex = (*it).first;
		entityIndex = (*it).second;
		entityId = this->environmentBasedId + entityIndex;
		entity = (SimplePhysicsEntity*)WorldDatabase::getEntityWithEnvironmentId(entityId);
		if (entity)
			entity->rigidBody = NULL;
	} // for

	delete articulatedBody;
} // ~ArticulatedPhysicsEntity
Ejemplo n.º 2
0
CursorSpringConnector::~CursorSpringConnector()
{
	Physics* physicsModule;
	physicsModule = (Physics*)SystemCore::getModuleByName("Physics");
	if (physicsModule) {
		physicsModule->removePhysicsObject(this);
		physicsModule->removeSimulationStepListener(this);
		physicsModule->removeSystemThreadListener(this);
	} // if
} // ~CursorSpringConnector