Ejemplo n.º 1
0
    void PhysicEngine::addRigidBody(RigidBody* body, bool addToMap, RigidBody* raycastingBody,bool actor)
    {
        if(!body && !raycastingBody)
            return; // nothing to do

        const std::string& name = (body ? body->mName : raycastingBody->mName);

        if (body){
            if(actor) dynamicsWorld->addRigidBody(body,CollisionType_Actor,CollisionType_World|CollisionType_HeightMap);
            else dynamicsWorld->addRigidBody(body,CollisionType_World,CollisionType_World|CollisionType_Actor|CollisionType_HeightMap);
        }

        if (raycastingBody)
            dynamicsWorld->addRigidBody(raycastingBody,CollisionType_Raycasting,CollisionType_Raycasting|CollisionType_World);

        if(addToMap){
            removeRigidBody(name);
            deleteRigidBody(name);

            if (body)
                mCollisionObjectMap[name] = body;
            if (raycastingBody)
                mRaycastingObjectMap[name] = raycastingBody;
        }
    }
Ejemplo n.º 2
0
    void SceneTerrain::setupRigidBody(RigidBody *rigidBody)
    {
        deleteRigidBody();

        this->rigidBody = rigidBody;
        if(physicsWorld && rigidBody)
        {
            physicsWorld->addBody(rigidBody);
        }
    }
Ejemplo n.º 3
0
 SceneTerrain::~SceneTerrain()
 {
     renderer3d->getTerrainManager()->removeTerrain(terrain);
     deleteRigidBody();
     deleteAIObjects();
 }