- Timestamp:
- Nov 12, 2008, 1:44:09 PM (16 years ago)
- Location:
- code/branches/physics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/physics
- Property svn:mergeinfo changed
/code/branches/physics (added) merged: 1913,1919-1920,1922-1925,1933,1963-1967,1971-1974,1983-1988,1995,2047
- Property svn:mergeinfo changed
-
code/branches/physics/src/orxonox/objects/worldentities/MovableEntity.h
r2087 r2192 38 38 namespace orxonox 39 39 { 40 class _OrxonoxExport MovableEntity : public WorldEntity , public Tickable, public network::ClientConnectionListener40 class _OrxonoxExport MovableEntity : public WorldEntity 41 41 { 42 42 public: … … 45 45 46 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 47 virtual void tick(float dt);48 47 void registerVariables(); 49 48 50 using WorldEntity::setPosition; 51 using WorldEntity::translate; 52 using WorldEntity::setOrientation; 53 using WorldEntity::rotate; 54 using WorldEntity::yaw; 55 using WorldEntity::pitch; 56 using WorldEntity::roll; 57 using WorldEntity::lookAt; 58 using WorldEntity::setDirection; 49 private: 59 50 60 void setPosition(const Vector3& position); 61 void translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL); 62 void setOrientation(const Quaternion& orientation); 63 void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL); 64 void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL); 65 void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL); 66 void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL); 67 void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); 68 void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); 51 //void attachPhysicalObject(WorldEntity* object); 69 52 70 inline void setVelocity(const Vector3& velocity) 71 { this->velocity_ = velocity; } 72 inline void setVelocity(float x, float y, float z) 73 { this->velocity_.x = x; this->velocity_.y = y; this->velocity_.z = z; } 74 inline const Vector3& getVelocity() const 75 { return this->velocity_; } 53 //// Bullet btMotionState related 54 //void setWorldTransform(const btTransform& worldTrans) 55 //{ 56 // this->node_->setPosition(worldTrans.getOrigin().x(), worldTrans.getOrigin().y(), worldTrans.getOrigin().z()); 57 // this->node_->setOrientation(worldTrans.getRotation().w(), worldTrans.getRotation().x(), worldTrans.getRotation().y(), worldTrans.getRotation().z()); 58 // //this->velocity_.x = this->physicalBody_-> 59 //} 76 60 77 inline void setAcceleration(const Vector3& acceleration) 78 { this->acceleration_ = acceleration; } 79 inline void setAcceleration(float x, float y, float z) 80 { this->acceleration_.x = x; this->acceleration_.y = y; this->acceleration_.z = z; } 81 inline const Vector3& getAcceleration() const 82 { return this->acceleration_; } 83 84 inline void setRotationAxis(const Vector3& axis) 85 { this->rotationAxis_ = axis; this->rotationAxis_.normalise(); } 86 inline void setRotationAxis(float x, float y, float z) 87 { this->rotationAxis_.x = x; this->rotationAxis_.y = y; this->rotationAxis_.z = z; rotationAxis_.normalise(); } 88 inline const Vector3& getRotationAxis() const 89 { return this->rotationAxis_; } 90 91 inline void setRotationRate(const Degree& angle) 92 { this->rotationRate_ = angle; } 93 inline void setRotationRate(const Radian& angle) 94 { this->rotationRate_ = angle; } 95 inline const Degree& getRotationRate() const 96 { return this->rotationRate_; } 97 98 inline void setMomentum(const Degree& angle) 99 { this->momentum_ = angle; } 100 inline void setMomentum(const Radian& angle) 101 { this->momentum_ = angle; } 102 inline const Degree& getMomentum() const 103 { return this->momentum_; } 104 105 private: 106 void clientConnected(unsigned int clientID); 107 void clientDisconnected(unsigned int clientID); 108 void resynchronize(); 109 110 void overwritePosition(); 111 void overwriteOrientation(); 112 113 Vector3 velocity_; 114 Vector3 acceleration_; 115 Vector3 rotationAxis_; 116 Degree rotationRate_; 117 Degree momentum_; 118 119 Vector3 overwrite_position_; 120 Quaternion overwrite_orientation_; 61 //// Bullet btMotionState related 62 //void getWorldTransform(btTransform& worldTrans) const 63 //{ 64 // worldTrans.setOrigin(btVector3(node_->getPosition().x, node_->getPosition().y, node_->getPosition().z)); 65 // worldTrans.setRotation(btQuaternion(node_->getOrientation().w, node_->getOrientation().x, node_->getOrientation().y, node_->getOrientation().z)); 66 //} 121 67 }; 122 68 }
Note: See TracChangeset
for help on using the changeset viewer.