Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 10, 2008, 1:38:17 PM (17 years ago)
Author:
rgrieder
Message:

Trying to synchronise phyiscs over the network.

  • Removed derivation of CollisionShape from WorldEntity (BaseObject instead).
File:
1 edited

Legend:

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

    r2306 r2374  
    3232#include "OrxonoxPrereqs.h"
    3333
    34 #include "objects/worldentities/StaticEntity.h"
     34#include "util/Math.h"
     35#include "core/BaseObject.h"
    3536
    3637namespace orxonox
    3738{
    38     class _OrxonoxExport CollisionShape : public StaticEntity
     39    class _OrxonoxExport CollisionShape : public BaseObject, public network::Synchronisable
    3940    {
    4041        public:
     
    4344
    4445            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     46            void registerVariables();
    4547
    46             btCollisionShape* getCollisionShape() const { return this->collisionShape_; }
    47             bool isCompoundShape() const { return this->bIsCompound_; }
     48            inline void setPosition(const Vector3& position)
     49                { this->position_ = position; }
     50            inline const Vector3& getPosition() const
     51                { return this->position_; }
    4852
    49             bool hasNoTransform() const;
    50             virtual btVector3 getTotalScaling();
     53            inline void setOrientation(const Quaternion& orientation)
     54                { this->orientation_ = orientation; }
     55            inline const Quaternion& getOrientation() const
     56                { return this->orientation_; }
     57
     58            void yaw(const Degree& angle)   { this->orientation_ = this->orientation_ * Quaternion(angle, Vector3::UNIT_Y); }
     59            void pitch(const Degree& angle) { this->orientation_ = this->orientation_ * Quaternion(angle, Vector3::UNIT_X); }
     60            void roll(const Degree& angle)  { this->orientation_ = this->orientation_ * Quaternion(angle, Vector3::UNIT_Z); }
     61
     62            virtual void setScale3D(const Vector3& scale);
     63            virtual void setScale(float scale);
     64            inline const Vector3& getScale3D(void) const
     65                { return this->scale_; }
     66
     67            virtual inline btCollisionShape* getCollisionShape() const
     68                { return this->collisionShape_; }
     69
     70            bool hasTransform() const;
     71
     72            inline void setParent(CompoundCollisionShape* shape, unsigned int ID)
     73                { this->parent_ = shape; this->parentID_ = ID; }
    5174
    5275        protected:
    53             bool              bIsCompound_;
    5476            btCollisionShape* collisionShape_;
    5577
    5678        private:
    57             virtual void setScale3D(const Vector3& scale);
    58             virtual void scale3D(const Vector3& scale);
     79            void updateParent();
    5980
    60             bool isCollisionTypeLegal(WorldEntity::CollisionType type) const;
     81            Vector3           position_;
     82            Quaternion        orientation_;
     83            Vector3           scale_;
     84            CompoundCollisionShape* parent_;
     85            unsigned int      parentID_;
    6186    };
    6287}
Note: See TracChangeset for help on using the changeset viewer.