Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 12, 2008, 1:44:09 PM (16 years ago)
Author:
rgrieder
Message:

Reverted all changes of attempt to update physics branch.

Location:
code/branches/physics
Files:
23 edited
400 copied

Legend:

Unmodified
Added
Removed
  • code/branches/physics

  • code/branches/physics/src/CMakeLists.txt

    r1854 r2192  
    22INCLUDE_DIRECTORIES(..)
    33INCLUDE_DIRECTORIES(orxonox)
     4INCLUDE_DIRECTORIES(bullet)
     5INCLUDE_DIRECTORIES(ogrebullet/Dynamics)
     6INCLUDE_DIRECTORIES(ogrebullet/Collisions)
    47
    58ADD_SUBDIRECTORY(cpptcl)
    69ADD_SUBDIRECTORY(ois)
    710ADD_SUBDIRECTORY(tinyxml)
     11ADD_SUBDIRECTORY(bullet)
     12ADD_SUBDIRECTORY(ogrebullet)
    813ADD_SUBDIRECTORY(lua)
    914ADD_SUBDIRECTORY(tolua)
  • code/branches/physics/src/core/XMLIncludes.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/physics/src/orxonox/CMakeLists.txt

    r2106 r2192  
    4646  objects/EventDispatcher.cc
    4747  objects/EventTarget.cc
     48  objects/HelloBullet.cc
    4849  objects/Radar.cc
    4950  objects/RadarListener.cc
     
    5556  objects/Scene.cc
    5657  objects/worldentities/WorldEntity.cc
     58  objects/worldentities/StaticEntity.cc
     59  objects/worldentities/MovableEntity.cc
    5760  objects/worldentities/PositionableEntity.cc
    58   objects/worldentities/MovableEntity.cc
     61  objects/worldentities/LinearEntity.cc
    5962  objects/worldentities/ControllableEntity.cc
    6063  objects/worldentities/Model.cc
     
    144147  tinyxml_orxonox
    145148  tolualib_orxonox
     149#LibBulletSoftBody
     150  LibBulletDynamics
     151  LibBulletCollision
     152  LibLinearMath
     153#ogrebullet_collisions_orxonox
     154#ogrebullet_dynamics_orxonox
    146155  util
    147156  core
  • code/branches/physics/src/orxonox/OrxonoxPrereqs.h

    r2096 r2192  
    103103
    104104    class WorldEntity;
     105    class StaticEntity;
     106    class MovableEntity;
    105107    class PositionableEntity;
    106     class MovableEntity;
    107108    class ControllableEntity;
     109    class LinearEntity;
    108110    class Sublevel;
    109111
     
    203205}
    204206
     207// Bullet Physics Engine
     208
     209class btRigidBody;
     210class btCollisionObject;
     211class btGhostObject;
     212class btCollisionShape;
     213class btSphereShape;
     214
     215
    205216struct lua_State;
    206217
  • code/branches/physics/src/orxonox/OrxonoxStableHeaders.h

    r2087 r2192  
    4848#include <CEGUI.h>
    4949#include "ois/OIS.h"
     50//#include "btBulletCollisionCommon.h"
     51//#include "btBulletDynamicsCommon.h"
    5052#include <boost/thread/recursive_mutex.hpp>
    5153//#include <boost/thread/mutex.hpp>
     
    9799#include "network/Synchronisable.h"
    98100
    99 #include "Settings.h"
     101//#include "Settings.h"
    100102
    101103//#endif /* ifdef NDEBUG */
  • code/branches/physics/src/orxonox/gamestates/GSLevel.cc

    r2103 r2192  
    5151namespace orxonox
    5252{
    53     SetCommandLineArgument(level, "sample2.oxw").shortcut("l");
     53    SetCommandLineArgument(level, "physicstest2.oxw").shortcut("l");
    5454
    5555    GSLevel::GSLevel()
  • code/branches/physics/src/orxonox/objects/Scene.cc

    r2087 r2192  
    7070        }
    7171
     72        /////////////
     73        // Physics //
     74        /////////////
     75
     76        // create bullet world; bullet solver etc.
     77
     78        // int maxProxies = 1024;
     79
     80        btVector3 worldAabbMin(-10000,-10000,-10000);
     81        btVector3 worldAabbMax(10000,10000,10000);
     82        bt32BitAxisSweep3* broadphase = new bt32BitAxisSweep3(worldAabbMin,worldAabbMax);
     83
     84        this -> collisionConfiguration_ = new btDefaultCollisionConfiguration();
     85        this -> dispatcher_ = new btCollisionDispatcher(collisionConfiguration_);
     86
     87        this -> solver_ = new btSequentialImpulseConstraintSolver;
     88
     89        this -> dynamicsWorld_ =  new btDiscreteDynamicsWorld(dispatcher_,broadphase,solver_,collisionConfiguration_);
     90
     91        dynamicsWorld_->setGravity(btVector3(0,-10,0));
     92
     93
    7294        // test test test
    7395        if (Core::showsGraphics() && this->sceneManager_)
     
    91113            if (Ogre::Root::getSingletonPtr())
    92114            {
    93 //                this->sceneManager_->destroySceneNode(this->rootSceneNode_->getName()); // TODO: remove getName() for newer versions of Ogre
    94115                Ogre::Root::getSingleton().destroySceneManager(this->sceneManager_);
    95116            }
  • code/branches/physics/src/orxonox/objects/Scene.h

    r2087 r2192  
    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_;
  • code/branches/physics/src/orxonox/objects/weaponSystem/WeaponSystem.h

  • code/branches/physics/src/orxonox/objects/worldentities/ControllableEntity.cc

    r2087 r2192  
    4444    CreateFactory(ControllableEntity);
    4545
    46     ControllableEntity::ControllableEntity(BaseObject* creator) : WorldEntity(creator)
     46    ControllableEntity::ControllableEntity(BaseObject* creator) : MovableEntity(creator)
    4747    {
    4848        RegisterObject(ControllableEntity);
  • code/branches/physics/src/orxonox/objects/worldentities/ControllableEntity.h

    r2087 r2192  
    3232#include "OrxonoxPrereqs.h"
    3333
    34 #include "WorldEntity.h"
     34#include "MovableEntity.h"
    3535#include "objects/Tickable.h"
    3636
    3737namespace orxonox
    3838{
    39     class _OrxonoxExport ControllableEntity : public WorldEntity, public Tickable
     39    class _OrxonoxExport ControllableEntity : public MovableEntity, public Tickable
    4040    {
    4141        public:
  • code/branches/physics/src/orxonox/objects/worldentities/Model.h

    r2087 r2192  
    7070}
    7171
    72 #endif /* _PositionableEntity_H__ */
     72#endif /* _Model_H__ */
  • code/branches/physics/src/orxonox/objects/worldentities/MovableEntity.cc

    r2087 r2192  
    3232#include "core/CoreIncludes.h"
    3333#include "core/XMLPort.h"
    34 #include "core/Executor.h"
    35 #include "tools/Timer.h"
    3634
    3735namespace orxonox
    3836{
    39     static const float MAX_RESYNCHRONIZE_TIME = 3.0f;
    40 
    41     CreateFactory(MovableEntity);
    42 
    4337    MovableEntity::MovableEntity(BaseObject* creator) : WorldEntity(creator)
    4438    {
    4539        RegisterObject(MovableEntity);
    46 
    47         this->velocity_ = Vector3::ZERO;
    48         this->acceleration_ = Vector3::ZERO;
    49         this->rotationAxis_ = Vector3::ZERO;
    50         this->rotationRate_ = 0;
    51         this->momentum_ = 0;
    52 
    53         this->overwrite_position_ = Vector3::ZERO;
    54         this->overwrite_orientation_ = Quaternion::IDENTITY;
    5540
    5641        this->registerVariables();
     
    6449    {
    6550        SUPER(MovableEntity, XMLPort, xmlelement, mode);
    66 
    67         XMLPortParamTemplate(MovableEntity, "velocity", setVelocity, getVelocity, xmlelement, mode, const Vector3&);
    68         XMLPortParamTemplate(MovableEntity, "rotationaxis", setRotationAxis, getRotationAxis, xmlelement, mode, const Vector3&);
    69         XMLPortParamTemplate(MovableEntity, "rotationrate", setRotationRate, getRotationRate, xmlelement, mode, const Degree&);
    70     }
    71 
    72     void MovableEntity::tick(float dt)
    73     {
    74         if (this->isActive())
    75         {
    76             this->velocity_ += (dt * this->acceleration_);
    77             this->node_->translate(dt * this->velocity_);
    78 
    79             this->rotationRate_ += (dt * this->momentum_);
    80             this->node_->rotate(this->rotationAxis_, this->rotationRate_  * dt);
    81         }
    8251    }
    8352
    8453    void MovableEntity::registerVariables()
    8554    {
    86         REGISTERDATA(this->velocity_.x, network::direction::toclient);
    87         REGISTERDATA(this->velocity_.y, network::direction::toclient);
    88         REGISTERDATA(this->velocity_.z, network::direction::toclient);
    89 
    90         REGISTERDATA(this->rotationAxis_.x, network::direction::toclient);
    91         REGISTERDATA(this->rotationAxis_.y, network::direction::toclient);
    92         REGISTERDATA(this->rotationAxis_.z, network::direction::toclient);
    93 
    94         REGISTERDATA(this->rotationRate_, network::direction::toclient);
    95 
    96         REGISTERDATA(this->overwrite_position_,    network::direction::toclient, new network::NetworkCallback<MovableEntity>(this, &MovableEntity::overwritePosition));
    97         REGISTERDATA(this->overwrite_orientation_, network::direction::toclient, new network::NetworkCallback<MovableEntity>(this, &MovableEntity::overwriteOrientation));
    98     }
    99 
    100     void MovableEntity::overwritePosition()
    101     {
    102         this->node_->setPosition(this->overwrite_position_);
    103     }
    104 
    105     void MovableEntity::overwriteOrientation()
    106     {
    107         this->node_->setOrientation(this->overwrite_orientation_);
    108     }
    109 
    110     void MovableEntity::clientConnected(unsigned int clientID)
    111     {
    112         new Timer<MovableEntity>(rnd() * MAX_RESYNCHRONIZE_TIME, false, this, createExecutor(createFunctor(&MovableEntity::resynchronize)), true);
    113     }
    114 
    115     void MovableEntity::clientDisconnected(unsigned int clientID)
    116     {
    117     }
    118 
    119     void MovableEntity::resynchronize()
    120     {
    121         this->overwrite_position_ = this->getPosition();
    122         this->overwrite_orientation_ = this->getOrientation();
    123     }
    124 
    125     void MovableEntity::setPosition(const Vector3& position)
    126     {
    127         this->node_->setPosition(position);
    128         this->overwrite_position_ = this->node_->getPosition();
    129     }
    130 
    131     void MovableEntity::translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo)
    132     {
    133         this->node_->translate(distance, relativeTo);
    134         this->overwrite_position_ = this->node_->getPosition();
    135     }
    136 
    137     void MovableEntity::setOrientation(const Quaternion& orientation)
    138     {
    139         this->node_->setOrientation(orientation);
    140         this->overwrite_orientation_ = this->node_->getOrientation();
    141     }
    142 
    143     void MovableEntity::rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo)
    144     {
    145         this->node_->rotate(rotation, relativeTo);
    146         this->overwrite_orientation_ = this->node_->getOrientation();
    147     }
    148 
    149     void MovableEntity::yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
    150     {
    151         this->node_->yaw(angle, relativeTo);
    152         this->overwrite_orientation_ = this->node_->getOrientation();
    153     }
    154 
    155     void MovableEntity::pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
    156     {
    157         this->node_->pitch(angle, relativeTo);
    158         this->overwrite_orientation_ = this->node_->getOrientation();
    159     }
    160 
    161     void MovableEntity::roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
    162     {
    163         this->node_->roll(angle, relativeTo);
    164         this->overwrite_orientation_ = this->node_->getOrientation();
    165     }
    166 
    167     void MovableEntity::lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)
    168     {
    169         this->node_->lookAt(target, relativeTo, localDirectionVector);
    170         this->overwrite_orientation_ = this->node_->getOrientation();
    171     }
    172 
    173     void MovableEntity::setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)
    174     {
    175         this->node_->setDirection(direction, relativeTo, localDirectionVector);
    176         this->overwrite_orientation_ = this->node_->getOrientation();
    17755    }
    17856}
  • code/branches/physics/src/orxonox/objects/worldentities/MovableEntity.h

    r2087 r2192  
    3838namespace orxonox
    3939{
    40     class _OrxonoxExport MovableEntity : public WorldEntity, public Tickable, public network::ClientConnectionListener
     40    class _OrxonoxExport MovableEntity : public WorldEntity
    4141    {
    4242        public:
     
    4545
    4646            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    47             virtual void tick(float dt);
    4847            void registerVariables();
    4948
    50             using WorldEntity::setPosition;
    51             using WorldEntity::translate;
    52             using WorldEntity::setOrientation;
    53             using WorldEntity::rotate;
    54             using WorldEntity::yaw;
    55             using WorldEntity::pitch;
    56             using WorldEntity::roll;
    57             using WorldEntity::lookAt;
    58             using WorldEntity::setDirection;
     49        private:
    5950
    60             void setPosition(const Vector3& position);
    61             void translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
    62             void setOrientation(const Quaternion& orientation);
    63             void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
    64             void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
    65             void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
    66             void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
    67             void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
    68             void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
     51            //void attachPhysicalObject(WorldEntity* object);
    6952
    70             inline void setVelocity(const Vector3& velocity)
    71                 { this->velocity_ = velocity; }
    72             inline void setVelocity(float x, float y, float z)
    73                 { this->velocity_.x = x; this->velocity_.y = y; this->velocity_.z = z; }
    74             inline const Vector3& getVelocity() const
    75                 { return this->velocity_; }
     53            //// Bullet btMotionState related
     54            //void setWorldTransform(const btTransform& worldTrans)
     55            //{
     56            //    this->node_->setPosition(worldTrans.getOrigin().x(), worldTrans.getOrigin().y(), worldTrans.getOrigin().z());
     57            //    this->node_->setOrientation(worldTrans.getRotation().w(), worldTrans.getRotation().x(), worldTrans.getRotation().y(), worldTrans.getRotation().z());
     58            //    //this->velocity_.x = this->physicalBody_->
     59            //}
    7660
    77             inline void setAcceleration(const Vector3& acceleration)
    78                 { this->acceleration_ = acceleration; }
    79             inline void setAcceleration(float x, float y, float z)
    80                 { this->acceleration_.x = x; this->acceleration_.y = y; this->acceleration_.z = z; }
    81             inline const Vector3& getAcceleration() const
    82                 { return this->acceleration_; }
    83 
    84             inline void setRotationAxis(const Vector3& axis)
    85                 { this->rotationAxis_ = axis; this->rotationAxis_.normalise(); }
    86             inline void setRotationAxis(float x, float y, float z)
    87                 { this->rotationAxis_.x = x; this->rotationAxis_.y = y; this->rotationAxis_.z = z; rotationAxis_.normalise(); }
    88             inline const Vector3& getRotationAxis() const
    89                 { return this->rotationAxis_; }
    90 
    91             inline void setRotationRate(const Degree& angle)
    92                 { this->rotationRate_ = angle; }
    93             inline void setRotationRate(const Radian& angle)
    94                 { this->rotationRate_ = angle; }
    95             inline const Degree& getRotationRate() const
    96                 { return this->rotationRate_; }
    97 
    98             inline void setMomentum(const Degree& angle)
    99                 { this->momentum_ = angle; }
    100             inline void setMomentum(const Radian& angle)
    101                 { this->momentum_ = angle; }
    102             inline const Degree& getMomentum() const
    103                 { return this->momentum_; }
    104 
    105         private:
    106             void clientConnected(unsigned int clientID);
    107             void clientDisconnected(unsigned int clientID);
    108             void resynchronize();
    109 
    110             void overwritePosition();
    111             void overwriteOrientation();
    112 
    113             Vector3 velocity_;
    114             Vector3 acceleration_;
    115             Vector3 rotationAxis_;
    116             Degree rotationRate_;
    117             Degree momentum_;
    118 
    119             Vector3 overwrite_position_;
    120             Quaternion overwrite_orientation_;
     61            //// Bullet btMotionState related
     62            //void getWorldTransform(btTransform& worldTrans) const
     63            //{
     64            //    worldTrans.setOrigin(btVector3(node_->getPosition().x, node_->getPosition().y, node_->getPosition().z));
     65            //    worldTrans.setRotation(btQuaternion(node_->getOrientation().w, node_->getOrientation().x, node_->getOrientation().y, node_->getOrientation().z));
     66            //}
    12167    };
    12268}
  • code/branches/physics/src/orxonox/objects/worldentities/PositionableEntity.cc

    r2087 r2192  
    3535    CreateFactory(PositionableEntity);
    3636
    37     PositionableEntity::PositionableEntity(BaseObject* creator) : WorldEntity(creator)
     37    PositionableEntity::PositionableEntity(BaseObject* creator) : MovableEntity(creator)
    3838    {
    3939        RegisterObject(PositionableEntity);
     
    5757        REGISTERDATA(this->getOrientation().z, network::direction::toclient);
    5858    }
     59
     60    //void PositionableEntity::attachPhysicalObject(WorldEntity* object)
     61    //{
     62    //}
    5963}
  • code/branches/physics/src/orxonox/objects/worldentities/PositionableEntity.h

    r2087 r2192  
    3131
    3232#include "OrxonoxPrereqs.h"
    33 #include "WorldEntity.h"
     33#include "MovableEntity.h"
    3434
    3535namespace orxonox
    3636{
    37     class _OrxonoxExport PositionableEntity : public WorldEntity
     37    class _OrxonoxExport PositionableEntity : public MovableEntity
    3838    {
    3939        public:
     
    7171            inline void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z)
    7272                { this->node_->setDirection(direction, relativeTo, localDirectionVector); }
     73
     74        private:
     75            //void attachPhysicalObject(WorldEntity* object);
    7376    };
    7477}
  • code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.cc

    r2087 r2192  
    3232#include <cassert>
    3333#include <OgreSceneManager.h>
     34#include "BulletCollision/CollisionShapes/btSphereShape.h"
    3435
    3536#include "core/CoreIncludes.h"
     
    6364        this->node_->setOrientation(Quaternion::IDENTITY);
    6465
     66        // Default behaviour does not include physics
     67        this->bAddedToPhysicalWorld_ = false;
     68        this->physicalBody_ = 0;
     69
    6570        this->registerVariables();
    6671    }
     
    7378            if (this->getScene()->getSceneManager())
    7479                this->getScene()->getSceneManager()->destroySceneNode(this->node_->getName());
     80           
     81            // Physics is not guaranteed, so check first
     82            if (this->physicalBody_)
     83            {
     84                if (this->bAddedToPhysicalWorld_)
     85                    this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
     86                if (this->physicalBody_->getCollisionShape())
     87                    delete this->physicalBody_->getCollisionShape();
     88                delete this->physicalBody_;
     89            }
    7590        }
    7691    }
     
    89104        XMLPortParamTemplate(WorldEntity, "scale3D", setScale3D, getScale3D, xmlelement, mode, const Vector3&);
    90105        XMLPortParam(WorldEntity, "scale", setScale, getScale, xmlelement, mode);
     106        XMLPortParam(WorldEntity, "collisionRadius", setcollisionRadius, getcollisionRadius, xmlelement, mode);
    91107
    92108        XMLPortObject(WorldEntity, WorldEntity, "attached", attach, getAttachedObject, xmlelement, mode);
     
    127143        object->parent_ = this;
    128144        object->parentID_ = this->getObjectID();
     145
     146        // Do the physical connection if required
     147        this->attachPhysicalObject(object);
    129148    }
    130149
     
    150169        return 0;
    151170    }
     171
     172    void WorldEntity::createPhysicalBody()
     173    {
     174        // Note: The motion state will be configured in a derived class.
     175        btRigidBody::btRigidBodyConstructionInfo bodyConstructionInfo(0, this, 0, btVector3(0,0,0));
     176        this->physicalBody_ = new btRigidBody(bodyConstructionInfo);
     177        this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
     178        this->bAddedToPhysicalWorld_ = true;
     179    }
     180
     181    void WorldEntity::setcollisionRadius(float radius)
     182    {
     183        if (!this->physicalBody_)
     184            createPhysicalBody();
     185
     186        // destroy old onw first
     187        btCollisionShape* oldShape = this->physicalBody_->getCollisionShape();
     188        if (oldShape)
     189            delete oldShape;
     190
     191        this->physicalBody_->setCollisionShape(new btSphereShape(btScalar(radius)));
     192    }
     193
     194    float WorldEntity::getcollisionRadius()
     195    {
     196        if (this->physicalBody_)
     197        {
     198            btSphereShape* sphere = dynamic_cast<btSphereShape*>(this->physicalBody_->getCollisionShape());
     199            if (sphere)
     200                return (float)sphere->getRadius();
     201        }
     202        return 0.0f;
     203    }
    152204}
  • code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.h

    r2087 r2192  
    3333
    3434#define OGRE_FORCE_ANGLE_TYPES
     35#include <OgreSceneNode.h>
    3536
    36 #include <OgreSceneNode.h>
     37#include "LinearMath/btMotionState.h"
     38#include "BulletDynamics/Dynamics/btRigidBody.h"
    3739
    3840#include "network/Synchronisable.h"
     
    4244namespace orxonox
    4345{
    44     class _OrxonoxExport WorldEntity : public BaseObject, public network::Synchronisable
     46    class _OrxonoxExport WorldEntity : public BaseObject, public network::Synchronisable, public btMotionState
    4547    {
    4648        public:
     
    125127                { this->node_->scale(scale, scale, scale); }
    126128
     129            void setcollisionRadius(float radius);
     130            float getcollisionRadius();
     131
     132            bool hasPhysics()  { return this->physicalBody_; }
     133            bool isKinematic() { return this->physicalBody_ && this->physicalBody_->isKinematicObject(); }
     134            bool isDynamic()   { return this->physicalBody_ && !this->physicalBody_->isStaticOrKinematicObject(); }
     135
    127136            void attach(WorldEntity* object);
    128137            void detach(WorldEntity* object);
     
    139148
    140149        protected:
     150            //virtual btCollisionShape* getCollisionShape() = 0;
     151
     152            void createPhysicalBody();
     153            virtual void attachPhysicalObject(WorldEntity* object) { }
     154
    141155            Ogre::SceneNode* node_;
     156            bool bAddedToPhysicalWorld_;
     157            btRigidBody* physicalBody_;
    142158
    143159        private:
     
    155171                { this->roll(angle); }
    156172
     173            // Bullet btMotionState related
     174            virtual void setWorldTransform(const btTransform& worldTrans)
     175            {
     176            }
     177
     178            // Bullet btMotionState related
     179            virtual void getWorldTransform(btTransform& worldTrans) const
     180            {
     181            }
     182
    157183            WorldEntity* parent_;
    158184            unsigned int parentID_;
  • code/branches/physics/src/tolua/tolua-5.1.pkg

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/physics/src/util

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/physics/src/util/Exception.cc

  • code/branches/physics/src/util/Exception.h

Note: See TracChangeset for help on using the changeset viewer.