Пример #1
0
void Object::resetPhysics()
{
	destroyPhysics ();	

	mp_node->setPosition(
		mp_node->getPosition().x
		, mp_node->getScale().y * 100 / 2
		, mp_node->getPosition().z
	);
	
	Ogre::Vector3 size = mp_node->getScale() * 100 * 0.5f * 1.0f;
	OgreBulletCollisions::BoxCollisionShape * shape = new OgreBulletCollisions::BoxCollisionShape(size);

	m_mass = msc_mass 
		* (mp_node->getScale().x * mp_node->getScale().y * mp_node->getScale().z)
		/ (msc_scale.x * msc_scale.y * msc_scale.z)
	;
	
	mp_body = new OgreBulletDynamics::RigidBody(m_name, mp_world);
	mp_body->setShape(mp_node, shape, m_restitution, m_friction, m_mass, mp_node->_getDerivedPosition(), Ogre::Quaternion::IDENTITY);
	mp_body->setLinearVelocity(Ogre::Vector3::UNIT_Y * 20.0f);
	mp_body->setCastShadows(true);
	mp_body->disableDeactivation();
	mp_body->setDamping(0.2f, 0.5f);
}
Пример #2
0
void Visualize::quitHk() {
	vdb.quitVdb();

	destroyPhysics();

	hkBaseSystem::quit();
	hkMemoryInitUtil::quit();

	quit_Irr();
}
BaseGameManager::~BaseGameManager()
{
    if(m_pPhysicsSystem)
        destroyPhysics();

    if(m_pBox2DRenderer)
        destroyPhysicsRenderer();

    if(m_pPhysicsSystem)
        destroyLua();

    if(m_pWorld)
        // I know calling virtual methods from destructors is a bad idea,
        // but the user is tasked with destroying things manually. 
        // this is more like damage control
        destroy();
}
Пример #4
0
Object::~Object()
{
	destroyPhysics();
	mp_node->detachAllObjects();
	--ms_count;
}