- Timestamp:
- Dec 11, 2008, 2:18:34 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/physics/src/orxonox/objects/worldentities/MovableEntity.h
r2407 r2408 21 21 * 22 22 * Author: 23 * Reto Grieder23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * Martin Stypinski25 * ... 26 26 * 27 27 */ … … 32 32 #include "OrxonoxPrereqs.h" 33 33 34 #include " WorldEntity.h"35 #include " objects/Tickable.h"34 #include "MobileEntity.h" 35 #include "network/ClientConnectionListener.h" 36 36 37 37 namespace orxonox 38 38 { 39 class _OrxonoxExport MovableEntity : public WorldEntity, public Tickable39 class _OrxonoxExport MovableEntity : public MobileEntity, public network::ClientConnectionListener 40 40 { 41 41 public: … … 47 47 void registerVariables(); 48 48 49 using WorldEntity::setPosition; 50 using WorldEntity::translate; 51 using WorldEntity::setOrientation; 52 using WorldEntity::rotate; 53 using WorldEntity::yaw; 54 using WorldEntity::pitch; 55 using WorldEntity::roll; 56 using WorldEntity::lookAt; 57 using WorldEntity::setDirection; 49 private: 50 void clientConnected(unsigned int clientID); 51 void clientDisconnected(unsigned int clientID); 52 void resynchronize(); 58 53 59 void setPosition(const Vector3& position); 60 void translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL); 61 void setOrientation(const Quaternion& orientation); 62 void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL); 63 void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL); 64 void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL); 65 void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL); 66 void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); 67 void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); 54 inline void processLinearVelocity() 55 { this->setVelocity(this->linearVelocity_); } 56 inline void processAngularVelocity() 57 { this->setAngularVelocity(this->angularVelocity_); } 68 58 69 void setVelocity(const Vector3& velocity); 70 inline void setVelocity(float x, float y, float z) 71 { this->setVelocity(Vector3(x, y, z)); } 72 inline const Vector3& getVelocity() const 73 { return this->linearVelocity_; } 59 void overwritePosition(); 60 void overwriteOrientation(); 74 61 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_; } 62 void positionChanged(bool bContinuous); 63 void orientationChanged(bool bContinuous); 80 64 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(); } 102 103 protected: 104 Vector3 linearAcceleration_; 105 Vector3 linearVelocity_; 106 Vector3 angularAcceleration_; 107 Vector3 angularVelocity_; 108 109 private: 110 virtual void positionChanged (bool bContinuous) = 0; 111 virtual void orientationChanged (bool bContinuous) = 0; 112 virtual void linearVelocityChanged (bool bContinuous) { } 113 virtual void angularVelocityChanged(bool bContinuous) { } 114 115 virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const; 116 117 // Bullet btMotionState related 118 void setWorldTransform(const btTransform& worldTrans); 119 void getWorldTransform(btTransform& worldTrans) const; 65 Vector3 overwrite_position_; 66 Quaternion overwrite_orientation_; 120 67 }; 121 68 }
Note: See TracChangeset
for help on using the changeset viewer.