Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 28, 2008, 1:25:16 AM (15 years ago)
Author:
rgrieder
Message:

Finally managed to work out some physics. According to my tests, collisions with simple spheres should work with dynamic/kinematic/static objects. There are currently only a limited number of XML parameters, but we're surely going to extend that. Furthermore there is some more thinking to be done concerning changes of btRigidBody properties when it's already added to the world.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.h

    r2192 r2292  
    4646    class _OrxonoxExport WorldEntity : public BaseObject, public network::Synchronisable, public btMotionState
    4747    {
     48        public:
     49            enum CollisionType
     50            {
     51                Dynamic,
     52                Kinematic,
     53                Static
     54            };
     55
    4856        public:
    4957            WorldEntity(BaseObject* creator);
     
    127135                { this->node_->scale(scale, scale, scale); }
    128136
    129             void setcollisionRadius(float radius);
    130             float getcollisionRadius();
    131 
    132137            bool hasPhysics()  { return this->physicalBody_; }
    133138            bool isKinematic() { return this->physicalBody_ && this->physicalBody_->isKinematicObject(); }
     
    147152                { return this->parent_; }
    148153
     154            void setCollisionRadius(float radius);
     155            float getCollisionRadius();
     156
     157            void setCollisionTypeStr(const std::string& type);
     158            std::string getCollisionTypeStr();
     159
     160            void setMass(float mass);
     161            float getMass();
     162
     163            CollisionType getCollisionType();
     164
    149165        protected:
    150166            //virtual btCollisionShape* getCollisionShape() = 0;
    151167
    152168            void createPhysicalBody();
    153             virtual void attachPhysicalObject(WorldEntity* object) { }
     169            //virtual void attachPhysicalObject(WorldEntity* object);
     170            virtual void setCollisionType(CollisionType type);
    154171
    155172            Ogre::SceneNode* node_;
    156             bool bAddedToPhysicalWorld_;
    157173            btRigidBody* physicalBody_;
    158174
     
    171187                { this->roll(angle); }
    172188
    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 
    183189            WorldEntity* parent_;
    184190            unsigned int parentID_;
Note: See TracChangeset for help on using the changeset viewer.