Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 13, 2008, 4:14:36 PM (15 years ago)
Author:
rgrieder
Message:
  • Added detach functions to CollisionShapes
  • Added update functions across the CollisionShape hierarchy so that when you change the radius of a sphere, everything up to the WE gets updated.
  • Setting the btCollisionShape at run time doesn't work after all, fixed that (you can still do it, just a question of internals)
  • Improved network synchronisation
  • new WE function: addedToPhysicalWorld() to check whether we can still perform operations that are disallowed at run time (esp. StaticEntity)

Conclusively, I can say that right now, all operations considering physics should be handled automatically, bugs not withstanding.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/physics/src/orxonox/objects/collisionshapes/CollisionShape.h

    r2377 r2423  
    3232#include "OrxonoxPrereqs.h"
    3333
     34#include "LinearMath/btVector3.h"
    3435#include "util/Math.h"
    3536#include "core/BaseObject.h"
     
    4849
    4950            inline void setPosition(const Vector3& position)
    50                 { this->position_ = position; }
     51                { this->position_ = position; this->updateParent(); }
    5152            inline const Vector3& getPosition() const
    5253                { return this->position_; }
    5354
    5455            inline void setOrientation(const Quaternion& orientation)
    55                 { this->orientation_ = orientation; }
     56                { this->orientation_ = orientation; this->updateParent(); }
    5657            inline const Quaternion& getOrientation() const
    5758                { return this->orientation_; }
    5859
    59             void yaw(const Degree& angle)   { this->orientation_ = this->orientation_ * Quaternion(angle, Vector3::UNIT_Y); }
    60             void pitch(const Degree& angle) { this->orientation_ = this->orientation_ * Quaternion(angle, Vector3::UNIT_X); }
    61             void roll(const Degree& angle)  { this->orientation_ = this->orientation_ * Quaternion(angle, Vector3::UNIT_Z); }
     60            void yaw(const Degree& angle)   { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_Y)); }
     61            void pitch(const Degree& angle) { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_X)); }
     62            void roll(const Degree& angle)  { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_Z)); }
    6263
    6364            virtual void setScale3D(const Vector3& scale);
     
    6667                { return this->scale_; }
    6768
    68             virtual inline btCollisionShape* getCollisionShape() const
     69            btVector3 getLocalInertia(float mass) const;
     70
     71            inline btCollisionShape* getCollisionShape() const
    6972                { return this->collisionShape_; }
    7073
     
    7578
    7679        protected:
    77             btCollisionShape* collisionShape_;
     80            virtual void updateParent();
     81
     82            btCollisionShape*       collisionShape_;
     83            CompoundCollisionShape* parent_;
    7884
    7985        private:
    80             void updateParent();
     86            void parentChanged();
    8187
    82             Vector3           position_;
    83             Quaternion        orientation_;
    84             Vector3           scale_;
    85             CompoundCollisionShape* parent_;
    86             unsigned int      parentID_;
     88            Vector3                 position_;
     89            Quaternion              orientation_;
     90            Vector3                 scale_;
     91            unsigned int            parentID_;
    8792    };
    8893}
Note: See TracChangeset for help on using the changeset viewer.