- Timestamp:
- Feb 14, 2009, 10:17:35 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/worldentities/ControllableEntity.h
r2087 r2662 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * ...25 * Reto Grieder 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 "objects/weaponSystem/WeaponSystem.h" 36 36 37 37 namespace orxonox 38 38 { 39 class _OrxonoxExport ControllableEntity : public WorldEntity, public Tickable39 class _OrxonoxExport ControllableEntity : public MobileEntity 40 40 { 41 41 public: … … 46 46 virtual void tick(float dt); 47 47 void registerVariables(); 48 void setConfigValues(); 49 50 virtual void changedGametype(); 48 51 49 52 virtual void setPlayer(PlayerInfo* player); … … 61 64 virtual void moveUpDown(const Vector2& value) {} 62 65 63 virtual void rotateYaw(const Vector2& value) {}64 virtual void rotatePitch(const Vector2& value) {}65 virtual void rotateRoll(const Vector2& value) {}66 virtual void rotateYaw(const Vector2& value); 67 virtual void rotatePitch(const Vector2& value); 68 virtual void rotateRoll(const Vector2& value); 66 69 67 virtual void fire() {} 68 virtual void altFire() {} 70 inline void moveFrontBack(float value) 71 { this->moveFrontBack(Vector2(value, 0)); } 72 inline void moveRightLeft(float value) 73 { this->moveRightLeft(Vector2(value, 0)); } 74 inline void moveUpDown(float value) 75 { this->moveUpDown(Vector2(value, 0)); } 69 76 77 inline void rotateYaw(float value) 78 { this->rotateYaw(Vector2(value, 0)); } 79 inline void rotatePitch(float value) 80 { this->rotatePitch(Vector2(value, 0)); } 81 inline void rotateRoll(float value) 82 { this->rotateRoll(Vector2(value, 0)); } 83 84 virtual void fire(WeaponMode::Enum fireMode) {} 85 virtual void altFire(WeaponMode::Enum fireMode) {} 86 87 virtual void boost() {} 70 88 virtual void greet() {} 71 89 virtual void use() {} 90 virtual void dropItems() {} 72 91 virtual void switchCamera(); 92 virtual void mouseLook(); 73 93 74 inline const Vector3& getVelocity() const75 { return this->velocity_; }76 inline const Vector3& getAcceleration() const77 { return this->acceleration_; }78 94 inline const std::string& getHudTemplate() const 79 95 { return this->hudtemplate_; } 80 81 using WorldEntity::setPosition;82 using WorldEntity::translate;83 using WorldEntity::setOrientation;84 using WorldEntity::rotate;85 using WorldEntity::yaw;86 using WorldEntity::pitch;87 using WorldEntity::roll;88 using WorldEntity::lookAt;89 using WorldEntity::setDirection;90 91 void setPosition(const Vector3& position);92 void translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);93 void setOrientation(const Quaternion& orientation);94 void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);95 void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);96 void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);97 void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);98 void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);99 void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);100 101 void setVelocity(const Vector3& velocity);102 inline void setVelocity(float x, float y, float z)103 { this->velocity_.x = x; this->velocity_.y = y; this->velocity_.z = z; }104 105 inline void setAcceleration(const Vector3& acceleration)106 { this->acceleration_ = acceleration; }107 inline void setAcceleration(float x, float y, float z)108 { this->acceleration_.x = x; this->acceleration_.y = y; this->acceleration_.z = z; }109 96 110 97 inline Camera* getCamera() const … … 123 110 { return this->cameraPositionTemplate_; } 124 111 112 using WorldEntity::setPosition; 113 using WorldEntity::setOrientation; 114 using MobileEntity::setVelocity; 115 using MobileEntity::setAngularVelocity; 116 117 void setPosition(const Vector3& position); 118 void setOrientation(const Quaternion& orientation); 119 void setVelocity(const Vector3& velocity); 120 void setAngularVelocity(const Vector3& velocity); 121 122 inline bool hasLocalController() const 123 { return this->bHasLocalController_; } 124 inline bool hasHumanController() const 125 { return this->bHasHumanController_; } 126 127 inline const GametypeInfo* getGametypeInfo() const 128 { return this->gtinfo_; } 129 130 inline bool isInMouseLook() const 131 { return this->bMouseLook_; } 132 inline float getMouseLookSpeed() const 133 { return this->mouseLookSpeed_; } 134 125 135 protected: 126 virtual void startLocal Control();127 virtual void stopLocal Control();136 virtual void startLocalHumanControl(); 137 virtual void stopLocalHumanControl(); 128 138 129 139 inline void setHudTemplate(const std::string& name) 130 140 { this->hudtemplate_ = name; } 131 132 inline bool isLocallyControlled() const133 { return this->bControlled_; }134 135 Vector3 acceleration_;136 141 137 142 private: … … 140 145 141 146 void processServerPosition(); 142 void processServer Velocity();147 void processServerLinearVelocity(); 143 148 void processServerOrientation(); 149 void processServerAngularVelocity(); 144 150 145 151 void processClientPosition(); 146 void processClient Velocity();152 void processClientLinearVelocity(); 147 153 void processClientOrientation(); 154 void processClientAngularVelocity(); 148 155 149 156 void networkcallback_changedplayerID(); 157 void networkcallback_changedgtinfoID(); 158 159 // Bullet btMotionState related 160 void setWorldTransform(const btTransform& worldTrans); 150 161 151 162 unsigned int server_overwrite_; 152 163 unsigned int client_overwrite_; 153 164 154 Vector3 velocity_; 165 bool bHasLocalController_; 166 bool bHasHumanController_; 167 bool bDestroyWhenPlayerLeft_; 155 168 156 bool bControlled_;157 169 Vector3 server_position_; 158 170 Vector3 client_position_; 159 Vector3 server_ velocity_;160 Vector3 client_ velocity_;171 Vector3 server_linear_velocity_; 172 Vector3 client_linear_velocity_; 161 173 Quaternion server_orientation_; 162 174 Quaternion client_orientation_; 175 Vector3 server_angular_velocity_; 176 Vector3 client_angular_velocity_; 163 177 164 178 PlayerInfo* player_; 165 179 unsigned int playerID_; 180 166 181 std::string hudtemplate_; 167 182 OverlayGroup* hud_; 183 168 184 Camera* camera_; 169 bool bDestroyWhenPlayerLeft_; 170 185 bool bMouseLook_; 186 float mouseLookSpeed_; 187 Ogre::SceneNode* cameraPositionRootNode_; 171 188 std::list<CameraPosition*> cameraPositions_; 172 189 std::string cameraPositionTemplate_; 190 191 const GametypeInfo* gtinfo_; 192 unsigned int gtinfoID_; 173 193 }; 174 194 }
Note: See TracChangeset
for help on using the changeset viewer.