All pastes #806173 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-12-05 00:23 UTC
rendered paste body
    void init(Ogre::SceneManager* nSM, const Ogre::Vector3& startingPos)
    {
    	//Get the ObjectManager and BulletManager
        XGE::ObjectManager* obMan = (XGE::ObjectManager*)XGE::Overlord::getSingletonPtr()->getManager("Object");
        XGE::Modules::BulletDynamics::BulletManager* bulletMan = (XGE::Modules::BulletDynamics::BulletManager*)XGE::Overlord::getSingletonPtr()->getManager("Bullet");

        //Create the Entity Component
        XGE::OC::Entity* ocEnt = (XGE::OC::Entity*)obMan->addComponent(this, "Model", "render.entity");

        //Create the Bullet Control Component
        XGE::Modules::BulletDynamics::OC::BulletControl* bulletCtrl = (XGE::Modules::BulletDynamics::OC::BulletControl*)obMan->addComponent(this, "BulletControl", "control.bullet");

        //Init Bullet Control
        btCollisionShape* collisionShape = new btBoxShape(btVector3(1,1,1));
        bulletCtrl->init(bulletMan, nSM, collisionShape, 10, startingPos, Ogre::Vector3(0.5,0.5,0.5), Ogre::Real(0), Ogre::Real(0), Ogre::Real(0.95), Ogre::Real(0.001));
        bulletMan->addBody(bulletCtrl->getBulletBody());
        bulletCtrl->getBulletBody()->getBTRigidBody()->setGravity(btVector3(0,-9.8,0));

		//Initialize the Entity component and attach it to the Basic Control Component
        ocEnt->init(nSM, bulletCtrl->getControlNode());
        ocEnt->createEntity("Box_" + this->strName + "_Model", "crate.mesh");
    }