Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2150 for code


Ignore:
Timestamp:
Nov 6, 2008, 12:54:29 PM (16 years ago)
Author:
martisty
Message:

Physics implementation in scene.cc

Location:
code/branches/physics/src/orxonox/objects
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/physics/src/orxonox/objects/HelloBullet.cc

    r2124 r2150  
    5757
    5858
    59         btVector3 worldAabbMin(-10000,-10000,-10000);
    60         btVector3 worldAabbMax(10000,10000,10000);
    61         btAxisSweep3* broadphase = new btAxisSweep3(worldAabbMin,worldAabbMax,maxProxies);
     59  //      btVector3 worldAabbMin(-10000,-10000,-10000);
     60  //      btVector3 worldAabbMax(10000,10000,10000);
     61  //      btAxisSweep3* broadphase = new btAxisSweep3(worldAabbMin,worldAabbMax,maxProxies);
    6262
    63         btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();
    64         btCollisionDispatcher* dispatcher = new btCollisionDispatcher(collisionConfiguration);
     63  //      btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();
     64  //      btCollisionDispatcher* dispatcher = new btCollisionDispatcher(collisionConfiguration);
    6565
    66         btSequentialImpulseConstraintSolver* solver = new btSequentialImpulseConstraintSolver;
     66  //      btSequentialImpulseConstraintSolver* solver = new btSequentialImpulseConstraintSolver;
    6767
    68         dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,broadphase,solver,collisionConfiguration);
     68  //      dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,broadphase,solver,collisionConfiguration);
    6969
    70         dynamicsWorld->setGravity(btVector3(0,-10,0));
     70        dynamicsWorld =  creator->getScene()->getPhysicalWorld();
     71        dynamicsWorld-> setGravity(btVector3(0,-10,0));
    7172
    7273
     
    180181    void HelloBullet::tick(float dt)
    181182    {
    182                 dynamicsWorld->stepSimulation(1/60.f,10);
     183                dynamicsWorld->stepSimulation(dt,10);
    183184                btTransform trans;
    184185                fallRigidBody->getMotionState()->getWorldTransform(trans);
    185                 COUT(0) << "sphere height: " << trans.getOrigin().getY() << std::endl;
     186               // COUT(0) << "sphere height: " << trans.getOrigin().getY() << std::endl;
    186187                sceneNode_ -> setPosition(Vector3(0,trans.getOrigin().getY(),0));
    187188        //      msleep(20);
  • code/branches/physics/src/orxonox/objects/Scene.cc

    r2087 r2150  
    6262                this->rootSceneNode_ = 0;
    6363            }
     64        // create bullet world; bullet solver etc.
     65
     66        // int maxProxies = 1024;
     67
     68        btVector3 worldAabbMin(-10000,-10000,-10000);
     69        btVector3 worldAabbMax(10000,10000,10000);
     70        bt32BitAxisSweep3* broadphase = new bt32BitAxisSweep3(worldAabbMin,worldAabbMax);
     71
     72        this -> collisionConfiguration_ = new btDefaultCollisionConfiguration();
     73        this -> dispatcher_ = new btCollisionDispatcher(collisionConfiguration_);
     74
     75        this -> solver_ = new btSequentialImpulseConstraintSolver;
     76
     77        this -> dynamicsWorld_ =  new btDiscreteDynamicsWorld(dispatcher_,broadphase,solver_,collisionConfiguration_);
     78
     79      //  dynamicsWorld->setGravity(btVector3(0,-10,0));
     80
    6481        }
    6582        else
  • code/branches/physics/src/orxonox/objects/Scene.h

    r2087 r2150  
    3636#include "util/Math.h"
    3737
     38#include "ogrebullet/Dynamics/OgreBulletDynamics.h"
     39
    3840namespace orxonox
    3941{
     
    5153            inline Ogre::SceneNode* getRootSceneNode() const
    5254                { return this->rootSceneNode_; }
     55
     56            inline btDiscreteDynamicsWorld* getPhysicalWorld() const
     57                { return this->dynamicsWorld_; }
    5358
    5459            void setSkybox(const std::string& skybox);
     
    7580            Ogre::SceneManager*    sceneManager_;
    7681            Ogre::SceneNode*       rootSceneNode_;
     82
     83            btDiscreteDynamicsWorld* dynamicsWorld_;
     84            btSequentialImpulseConstraintSolver* solver_;
     85            btDefaultCollisionConfiguration* collisionConfiguration_;
     86            btCollisionDispatcher* dispatcher_;
     87            // Point auf Bullet btDynamics world && solver
     88
    7789            std::string            skybox_;
    7890            ColourValue            ambientLight_;
Note: See TracChangeset for help on using the changeset viewer.