- Timestamp:
- Nov 12, 2008, 4:17:02 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/physics/src/orxonox/objects/worldentities/MovableEntity.cc
r2192 r2201 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * ...25 * Martin Stypinski 26 26 * 27 27 */ … … 29 29 #include "OrxonoxStableHeaders.h" 30 30 #include "MovableEntity.h" 31 32 #include "objects/Scene.h" 31 33 32 34 #include "core/CoreIncludes.h" … … 54 56 { 55 57 } 58 59 void MovableEntity::setPosition(const Vector3& position){ 60 // Here the code 61 if(isDynamic() && bAddedToPhysicalWorld_){ 62 this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_); 63 this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_); 64 } 65 this->node_->setPosition(position); 66 positionChanged(); 67 } 68 69 void MovableEntity::translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo){ 70 if(isDynamic() && bAddedToPhysicalWorld_){ 71 this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_); 72 this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_); 73 } 74 this->node_->translate(distance, relativeTo); 75 translateChanged(); 76 } 77 78 void MovableEntity::setOrientation(const Quaternion& orientation){ 79 if(isDynamic() && bAddedToPhysicalWorld_){ 80 this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_); 81 this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_); 82 } 83 this->node_->setOrientation(orientation); 84 orientationChanged(); 85 } 86 87 void MovableEntity::rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo){ 88 if(isDynamic() && bAddedToPhysicalWorld_){ 89 this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_); 90 this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_); 91 } 92 this->node_->rotate(rotation, relativeTo); 93 rotateChanged(); 94 } 95 96 void MovableEntity::yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo){ 97 if(isDynamic() && bAddedToPhysicalWorld_){ 98 this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_); 99 this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_); 100 } 101 this->node_->yaw(angle, relativeTo); 102 yawChanged(); 103 } 104 105 void MovableEntity::pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo){ 106 if(isDynamic() && bAddedToPhysicalWorld_){ 107 this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_); 108 this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_); 109 } 110 this->node_->pitch(angle, relativeTo); 111 pitchChanged(); 112 } 113 114 void MovableEntity::roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo){ 115 if(isDynamic() && bAddedToPhysicalWorld_){ 116 this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_); 117 this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_); 118 } 119 this->node_->roll(angle, relativeTo); 120 rollChanged(); 121 } 122 123 void MovableEntity::lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector){ 124 if(isDynamic() && bAddedToPhysicalWorld_){ 125 this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_); 126 this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_); 127 } 128 this->node_->lookAt(target, relativeTo, localDirectionVector); 129 lookAtChanged(); 130 } 131 132 void MovableEntity::setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector){ 133 if(isDynamic() && bAddedToPhysicalWorld_){ 134 this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_); 135 this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_); 136 } 137 this->node_->setDirection(direction, relativeTo, localDirectionVector); 138 directionChanged(); 139 } 140 56 141 }
Note: See TracChangeset
for help on using the changeset viewer.