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/MovableEntity.h

    r2304 r2374  
    3434#include "WorldEntity.h"
    3535#include "objects/Tickable.h"
    36 #include "network/ClientConnectionListener.h"
    3736
    3837namespace orxonox
    3938{
    40     class _OrxonoxExport MovableEntity : public WorldEntity
     39    class _OrxonoxExport MovableEntity : public WorldEntity, public Tickable
    4140    {
    4241        public:
     
    4544
    4645            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     46            virtual void tick(float dt);
    4747            void registerVariables();
    4848
     
    6969            void setVelocity(const Vector3& velocity);
    7070            inline void setVelocity(float x, float y, float z)
    71                 { this->velocity_.x = x; this->velocity_.y = y; this->velocity_.z = z; }
     71                { this->setVelocity(Vector3(x, y, z)); }
    7272            inline const Vector3& getVelocity() const
    73                 { return this->velocity_; }
     73                { return this->linearVelocity_; }
     74
     75            void setAngularVelocity(const Vector3& velocity);
     76            inline void setAngularVelocity(float x, float y, float z)
     77                { this->setAngularVelocity(Vector3(x, y, z)); }
     78            inline const Vector3& getAngularVelocity() const
     79                { return this->linearAcceleration_; }
     80
     81            void setAcceleration(const Vector3& acceleration);
     82            inline void setAcceleration(float x, float y, float z)
     83                { this->setAcceleration(Vector3(x, y, z)); }
     84            inline const Vector3& getAcceleration() const
     85                { return this->linearAcceleration_; }
     86
     87            void setAngularAcceleration(const Vector3& acceleration);
     88            inline void setAngularAcceleration(float x, float y, float z)
     89                { this->setAngularAcceleration(Vector3(x, y, z)); }
     90            inline const Vector3& getAngularAcceleration() const
     91                { return this->angularAcceleration_; }
     92
     93            inline void setRotationRate(Degree rate)
     94                { this->setAngularVelocity(this->getAngularVelocity().normalisedCopy() * rate.valueRadians()); }
     95            inline Degree getRotationRate() const
     96                { return Degree(this->getAngularVelocity().length()); }
     97
     98            inline void setRotationAxis(const Vector3& axis)
     99                { this->setAngularVelocity(axis * this->getAngularVelocity().length()); }
     100            inline Vector3 getRotationAxis() const
     101                { return this->getAngularVelocity().normalisedCopy(); }
    74102
    75103        protected:
    76             Vector3 velocity_;
     104            Vector3 linearAcceleration_;
     105            Vector3 linearVelocity_;
     106            Vector3 angularAcceleration_;
     107            Vector3 angularVelocity_;
    77108
    78109        private:
    79             //void attachPhysicalObject(WorldEntity* object);
    80 
    81             virtual void positionChanged() { }
    82             virtual void orientationChanged() { }
    83             virtual void velocityChanged() { }
     110            virtual void positionChanged       (bool bContinuous) { }
     111            virtual void orientationChanged    (bool bContinuous) { }
     112            virtual void linearVelocityChanged (bool bContinuous) { }
     113            virtual void angularVelocityChanged(bool bContinuous) { }
    84114
    85115            virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const;
Note: See TracChangeset for help on using the changeset viewer.