Example #1
0
    //-------------------------------------------------------------------------
    void OgreHead::setUp(const String& name)
    {
        // Create visual presence
        SceneManager* sm = World::getSingleton().getSceneManager();
        mEntity = sm->createEntity(name, "OgreHead.mesh");
        mSceneNode = sm->getRootSceneNode()->createChildSceneNode(name);
        mSceneNode->attachObject(mEntity);
        // Add reverse reference
        mEntity->setUserObject(this);

        // Create mass body
        mOdeBody = new dBody(World::getSingleton().getOdeWorld()->id());
        // Set reverse reference
        mOdeBody->setData(this);
        // Set mass 
        setMassSphere(0.1, 25); // TODO change to more realistic values

        this->setBounceParameters(0.3, 0.1);
        this->setSoftness(0.0f);
        this->setFriction(Math::POS_INFINITY);

        // Create collision proxy
        dSphere* odeSphere = new dSphere(0, 25);
        mCollisionProxies.push_back(odeSphere);
        updateCollisionProxies();


    }
//-----------------------------------------------------------------------
void CollideCamera::setUp(const String& name)
{
    // Create visual presence
    SceneManager* sm = World::getSingleton().getSceneManager();
    mSceneNode = sm->getRootSceneNode()->createChildSceneNode(name);

    mCamera = sm->createCamera(name);

    mSceneNode->attachObject(mCamera);
    // Add reverse reference (to self!)
    mCamera->setUserObject(this);

    // No mass body (considered static)

    // Create collision proxy, at near dist
    // SpaceID is irrelevant, we're doing our own spacial partitioning
    dSphere* odeSphere = new dSphere(0, mCamera->getNearClipDistance());
    mCollisionProxies.push_back(odeSphere);
    updateCollisionProxies();


}