Changeset 2426 for code/branches/physics/src/orxonox/objects/worldentities
- Timestamp:
- Dec 13, 2008, 8:55:40 PM (16 years ago)
- Location:
- code/branches/physics/src/orxonox/objects/worldentities
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/physics/src/orxonox/objects/worldentities/MobileEntity.cc
r2408 r2426 30 30 #include "MobileEntity.h" 31 31 32 #include <OgreSceneNode.h> 32 33 #include "BulletDynamics/Dynamics/btRigidBody.h" 33 34 … … 117 118 } 118 119 119 void MobileEntity::translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo)120 {121 if (this->isDynamic())122 {123 OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot translate physical object relative \124 to any other space than TS_LOCAL.");125 this->physicalBody_->translate(btVector3(distance.x, distance.y, distance.z));126 }127 128 this->node_->translate(distance, relativeTo);129 positionChanged(false);130 }131 132 120 void MobileEntity::setOrientation(const Quaternion& orientation) 133 121 { … … 140 128 141 129 this->node_->setOrientation(orientation); 142 orientationChanged(false);143 }144 145 void MobileEntity::rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo)146 {147 if (this->isDynamic())148 {149 OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot rotate physical object relative \150 to any other space than TS_LOCAL.");151 btTransform transf = this->physicalBody_->getWorldTransform();152 this->physicalBody_->setWorldTransform(transf * btTransform(btQuaternion(rotation.x, rotation.y, rotation.z, rotation.w)));153 }154 155 this->node_->rotate(rotation, relativeTo);156 orientationChanged(false);157 }158 159 void MobileEntity::yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo)160 {161 if (this->isDynamic())162 {163 OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot yaw physical object relative \164 to any other space than TS_LOCAL.");165 btTransform transf = this->physicalBody_->getWorldTransform();166 btTransform rotation(btQuaternion(angle.valueRadians(), 0.0f, 0.0f));167 this->physicalBody_->setWorldTransform(transf * rotation);168 }169 170 this->node_->yaw(angle, relativeTo);171 orientationChanged(false);172 }173 174 void MobileEntity::pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo)175 {176 if (this->isDynamic())177 {178 OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot pitch physical object relative \179 to any other space than TS_LOCAL.");180 btTransform transf = this->physicalBody_->getWorldTransform();181 btTransform rotation(btQuaternion(0.0f, angle.valueRadians(), 0.0f));182 this->physicalBody_->setWorldTransform(transf * rotation);183 }184 185 this->node_->pitch(angle, relativeTo);186 orientationChanged(false);187 }188 189 void MobileEntity::roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo)190 {191 if (this->isDynamic())192 {193 OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot roll physical object relative \194 to any other space than TS_LOCAL.");195 btTransform transf = this->physicalBody_->getWorldTransform();196 btTransform rotation(btQuaternion(angle.valueRadians(), 0.0f, 0.0f));197 this->physicalBody_->setWorldTransform(transf * rotation);198 }199 200 this->node_->roll(angle, relativeTo);201 orientationChanged(false);202 }203 204 void MobileEntity::lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)205 {206 if (this->isDynamic())207 {208 ThrowException(NotImplemented, "ControllableEntity::lookAt() is not yet supported for physical objects.");209 OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot align physical object relative \210 to any other space than TS_LOCAL.");211 }212 213 this->node_->lookAt(target, relativeTo, localDirectionVector);214 orientationChanged(false);215 }216 217 void MobileEntity::setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)218 {219 if (this->isDynamic())220 {221 ThrowException(NotImplemented, "ControllableEntity::setDirection() is not yet supported for physical objects.");222 OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot align physical object relative \223 to any other space than TS_LOCAL.");224 }225 226 this->node_->setDirection(direction, relativeTo, localDirectionVector);227 130 orientationChanged(false); 228 131 } -
code/branches/physics/src/orxonox/objects/worldentities/MobileEntity.h
r2408 r2426 48 48 49 49 using WorldEntity::setPosition; 50 using WorldEntity::translate;51 50 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;58 51 59 52 void setPosition(const Vector3& position); 60 void translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);61 53 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);68 54 69 55 void setVelocity(const Vector3& velocity); -
code/branches/physics/src/orxonox/objects/worldentities/StaticEntity.cc
r2423 r2426 31 31 #include "StaticEntity.h" 32 32 33 #include <OgreSceneNode.h> 33 34 #include "BulletDynamics/Dynamics/btRigidBody.h" 34 35 … … 72 73 } 73 74 74 void StaticEntity::translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo)75 {76 if (this->addedToPhysicalWorld())77 ThrowException(PhysicsViolation, "Cannot change position or orientation of a StaticEntity with physics at run time.");78 if (this->isStatic())79 {80 OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot translate physical object relative \81 to any other space than TS_LOCAL.");82 this->physicalBody_->translate(btVector3(distance.x, distance.y, distance.z));83 }84 85 this->node_->translate(distance, relativeTo);86 }87 88 75 void StaticEntity::setOrientation(const Quaternion& orientation) 89 76 { … … 98 85 99 86 this->node_->setOrientation(orientation); 100 }101 102 void StaticEntity::rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo)103 {104 if (this->addedToPhysicalWorld())105 ThrowException(PhysicsViolation, "Cannot change position or orientation of a StaticEntity with physics at run time.");106 if (this->isStatic())107 {108 OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot rotate physical object relative \109 to any other space than TS_LOCAL.");110 btTransform transf = this->physicalBody_->getWorldTransform();111 this->physicalBody_->setWorldTransform(transf * btTransform(btQuaternion(rotation.x, rotation.y, rotation.z, rotation.w)));112 }113 114 this->node_->rotate(rotation, relativeTo);115 }116 117 void StaticEntity::yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo)118 {119 if (this->addedToPhysicalWorld())120 ThrowException(PhysicsViolation, "Cannot change position or orientation of a StaticEntity with physics at run time.");121 if (this->isStatic())122 {123 OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot yaw physical object relative \124 to any other space than TS_LOCAL.");125 btTransform transf = this->physicalBody_->getWorldTransform();126 btTransform rotation(btQuaternion(angle.valueRadians(), 0.0f, 0.0f));127 this->physicalBody_->setWorldTransform(transf * rotation);128 }129 130 this->node_->yaw(angle, relativeTo);131 }132 133 void StaticEntity::pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo)134 {135 if (this->addedToPhysicalWorld())136 ThrowException(PhysicsViolation, "Cannot change position or orientation of a StaticEntity with physics at run time.");137 if (this->isStatic())138 {139 OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot pitch physical object relative \140 to any other space than TS_LOCAL.");141 btTransform transf = this->physicalBody_->getWorldTransform();142 btTransform rotation(btQuaternion(0.0f, angle.valueRadians(), 0.0f));143 this->physicalBody_->setWorldTransform(transf * rotation);144 }145 146 this->node_->pitch(angle, relativeTo);147 }148 149 void StaticEntity::roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo)150 {151 if (this->addedToPhysicalWorld())152 ThrowException(PhysicsViolation, "Cannot change position or orientation of a StaticEntity with physics at run time.");153 if (this->isStatic())154 {155 OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot roll physical object relative \156 to any other space than TS_LOCAL.");157 btTransform transf = this->physicalBody_->getWorldTransform();158 btTransform rotation(btQuaternion(angle.valueRadians(), 0.0f, 0.0f));159 this->physicalBody_->setWorldTransform(transf * rotation);160 }161 162 this->node_->roll(angle, relativeTo);163 }164 165 void StaticEntity::lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)166 {167 if (this->addedToPhysicalWorld())168 ThrowException(PhysicsViolation, "Cannot change position or orientation of a StaticEntity with physics at run time.");169 if (this->isStatic())170 {171 ThrowException(NotImplemented, "ControllableEntity::lookAt() is not yet supported for physical objects.");172 OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot align physical object relative \173 to any other space than TS_LOCAL.");174 }175 176 this->node_->lookAt(target, relativeTo, localDirectionVector);177 }178 179 void StaticEntity::setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)180 {181 if (this->addedToPhysicalWorld())182 ThrowException(PhysicsViolation, "Cannot change position or orientation of a StaticEntity with physics at run time.");183 if (this->isStatic())184 {185 ThrowException(NotImplemented, "ControllableEntity::setDirection() is not yet supported for physical objects.");186 OrxAssert(relativeTo == Ogre::Node::TS_LOCAL, "Cannot align physical object relative \187 to any other space than TS_LOCAL.");188 }189 190 this->node_->setDirection(direction, relativeTo, localDirectionVector);191 87 } 192 88 -
code/branches/physics/src/orxonox/objects/worldentities/StaticEntity.h
r2374 r2426 45 45 46 46 using WorldEntity::setPosition; 47 using WorldEntity::translate;48 47 using WorldEntity::setOrientation; 49 using WorldEntity::rotate;50 using WorldEntity::yaw;51 using WorldEntity::pitch;52 using WorldEntity::roll;53 using WorldEntity::lookAt;54 using WorldEntity::setDirection;55 48 56 49 void setPosition(const Vector3& position); 57 void translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);58 50 void setOrientation(const Quaternion& orientation); 59 void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);60 void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);61 void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);62 void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);63 void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);64 void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);65 51 66 52 private: 67 53 bool isCollisionTypeLegal(CollisionType type) const; 68 54 55 // network callbacks 69 56 inline void positionChanged() 70 57 { this->setPosition(this->getPosition()); } -
code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.cc
r2423 r2426 32 32 33 33 #include <cassert> 34 #include <OgreSceneNode.h> 34 35 #include <OgreSceneManager.h> 35 36 #include "BulletDynamics/Dynamics/btRigidBody.h" … … 249 250 } 250 251 252 void WorldEntity::attachOgreObject(Ogre::MovableObject* object) 253 { 254 this->node_->attachObject(object); 255 } 256 257 void WorldEntity::detachOgreObject(Ogre::MovableObject* object) 258 { 259 this->node_->detachObject(object); 260 } 261 262 Ogre::MovableObject* WorldEntity::detachOgreObject(const Ogre::String& name) 263 { 264 return this->node_->detachObject(name); 265 } 266 251 267 void WorldEntity::attachCollisionShape(CollisionShape* shape) 252 268 { … … 289 305 } 290 306 307 #ifndef _NDEBUG 308 const Vector3& WorldEntity::getPosition() const 309 { 310 return this->node_->getPosition(); 311 } 312 313 const Quaternion& WorldEntity::getOrientation() const 314 { 315 return this->node_->getOrientation(); 316 } 317 318 const Vector3& WorldEntity::getScale3D() const 319 { 320 return this->node_->getScale(); 321 } 322 #endif 323 324 const Vector3& WorldEntity::getWorldPosition() const 325 { 326 return this->node_->_getDerivedPosition(); 327 } 328 329 const Quaternion& WorldEntity::getWorldOrientation() const 330 { 331 return this->node_->_getDerivedOrientation(); 332 } 333 334 void WorldEntity::translate(const Vector3& distance, TransformSpace::Space relativeTo) 335 { 336 switch (relativeTo) 337 { 338 case TransformSpace::Local: 339 // position is relative to parent so transform downwards 340 this->setPosition(this->getPosition() + this->getOrientation() * distance); 341 break; 342 case TransformSpace::Parent: 343 this->setPosition(this->getPosition() + distance); 344 break; 345 case TransformSpace::World: 346 // position is relative to parent so transform upwards 347 if (this->node_->getParent()) 348 setPosition(getPosition() + (node_->getParent()->_getDerivedOrientation().Inverse() * distance) 349 / node_->getParent()->_getDerivedScale()); 350 else 351 this->setPosition(this->getPosition() + distance); 352 break; 353 } 354 } 355 356 void WorldEntity::rotate(const Quaternion& rotation, TransformSpace::Space relativeTo) 357 { 358 switch(relativeTo) 359 { 360 case TransformSpace::Local: 361 this->setOrientation(this->getOrientation() * rotation); 362 break; 363 case TransformSpace::Parent: 364 // Rotations are normally relative to local axes, transform up 365 this->setOrientation(rotation * this->getOrientation()); 366 break; 367 case TransformSpace::World: 368 // Rotations are normally relative to local axes, transform up 369 this->setOrientation(this->getOrientation() * this->getWorldOrientation().Inverse() 370 * rotation * this->getWorldOrientation()); 371 break; 372 } 373 } 374 375 void WorldEntity::lookAt(const Vector3& target, TransformSpace::Space relativeTo, const Vector3& localDirectionVector) 376 { 377 Vector3 origin; 378 switch (relativeTo) 379 { 380 case TransformSpace::Local: 381 origin = Vector3::ZERO; 382 break; 383 case TransformSpace::Parent: 384 origin = this->getPosition(); 385 break; 386 case TransformSpace::World: 387 origin = this->getWorldPosition(); 388 break; 389 } 390 this->setDirection(target - origin, relativeTo, localDirectionVector); 391 } 392 393 void WorldEntity::setDirection(const Vector3& direction, TransformSpace::Space relativeTo, const Vector3& localDirectionVector) 394 { 395 Quaternion savedOrientation(this->getOrientation()); 396 Ogre::Node::TransformSpace ogreRelativeTo; 397 switch (relativeTo) 398 { 399 case TransformSpace::Local: 400 ogreRelativeTo = Ogre::Node::TS_LOCAL; break; 401 case TransformSpace::Parent: 402 ogreRelativeTo = Ogre::Node::TS_PARENT; break; 403 case TransformSpace::World: 404 ogreRelativeTo = Ogre::Node::TS_WORLD; break; 405 } 406 this->node_->setDirection(direction, ogreRelativeTo, localDirectionVector); 407 Quaternion newOrientation(this->node_->getOrientation()); 408 this->node_->setOrientation(savedOrientation); 409 this->setOrientation(newOrientation); 410 } 411 291 412 void WorldEntity::setScale3D(const Vector3& scale) 292 413 { … … 295 416 296 417 this->node_->setScale(scale); 297 }298 299 void WorldEntity::scale3D(const Vector3& scale)300 {301 if (this->hasPhysics())302 ThrowException(NotImplemented, "Cannot set the scale of a physical object: Not yet implemented.");303 304 this->node_->scale(scale);305 418 } 306 419 -
code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.h
r2423 r2426 33 33 #include "OrxonoxPrereqs.h" 34 34 35 # define OGRE_FORCE_ANGLE_TYPES35 #ifdef _NDEBUG 36 36 #include <OgreSceneNode.h> 37 #else 38 #include <OgrePrerequisites.h> 39 #endif 37 40 #include "LinearMath/btMotionState.h" 38 41 … … 65 68 inline void setPosition(float x, float y, float z) 66 69 { this->setPosition(Vector3(x, y, z)); } 67 inline const Vector3& getPosition() const 68 { return this->node_->getPosition(); } 69 inline const Vector3& getWorldPosition() const 70 { return this->node_->getWorldPosition(); } 71 72 virtual void translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0; 73 inline void translate(float x, float y, float z, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) 70 const Vector3& getPosition() const; 71 const Vector3& getWorldPosition() const; 72 73 void translate(const Vector3& distance, TransformSpace::Space relativeTo = TransformSpace::Parent); 74 inline void translate(float x, float y, float z, TransformSpace::Space relativeTo = TransformSpace::Parent) 74 75 { this->translate(Vector3(x, y, z), relativeTo); } 75 76 … … 81 82 inline void setOrientation(const Vector3& axis, const Degree& angle) 82 83 { this->setOrientation(Quaternion(angle, axis)); } 83 inline const Quaternion& getOrientation() const 84 { return this->node_->getOrientation(); } 85 inline const Quaternion& getWorldOrientation() const 86 { return this->node_->getWorldOrientation(); } 87 88 virtual void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0; 89 inline void rotate(const Vector3& axis, const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) 84 const Quaternion& getOrientation() const; 85 const Quaternion& getWorldOrientation() const; 86 87 void rotate(const Quaternion& rotation, TransformSpace::Space relativeTo = TransformSpace::Local); 88 inline void rotate(const Vector3& axis, const Degree& angle, TransformSpace::Space relativeTo = TransformSpace::Local) 90 89 { this->rotate(Quaternion(angle, axis), relativeTo); } 91 inline void rotate(const Vector3& axis, const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) 92 { this->rotate(Quaternion(angle, axis), relativeTo); } 93 94 virtual void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0; 95 inline void yaw(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) 96 { this->yaw(Degree(angle), relativeTo); } 97 virtual void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0; 98 inline void pitch(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) 99 { this->pitch(Degree(angle), relativeTo); } 100 virtual void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0; 101 inline void roll(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) 102 { this->roll(Degree(angle), relativeTo); } 103 104 virtual void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z) = 0; 105 virtual void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z) = 0; 106 inline void setDirection(float x, float y, float z, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z) 90 91 inline void yaw(const Degree& angle, TransformSpace::Space relativeTo = TransformSpace::Local) 92 { this->rotate(Quaternion(angle, Vector3::UNIT_Y), relativeTo); } 93 inline void pitch(const Degree& angle, TransformSpace::Space relativeTo = TransformSpace::Local) 94 { this->rotate(Quaternion(angle, Vector3::UNIT_X), relativeTo); } 95 inline void roll(const Degree& angle, TransformSpace::Space relativeTo = TransformSpace::Local) 96 { this->rotate(Quaternion(angle, Vector3::UNIT_Z), relativeTo); } 97 98 void lookAt(const Vector3& target, TransformSpace::Space relativeTo = TransformSpace::Parent, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); 99 void setDirection(const Vector3& direction, TransformSpace::Space relativeTo = TransformSpace::Local, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z); 100 inline void setDirection(float x, float y, float z, TransformSpace::Space relativeTo = TransformSpace::Local, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z) 107 101 { this->setDirection(Vector3(x, y, z), relativeTo, localDirectionVector); } 108 102 … … 110 104 inline void setScale3D(float x, float y, float z) 111 105 { this->setScale3D(Vector3(x, y, z)); } 112 inline const Vector3& getScale3D(void) const 113 { return this->node_->getScale(); } 106 const Vector3& getScale3D(void) const; 114 107 115 108 void setScale(float scale) … … 118 111 { Vector3 scale = this->getScale3D(); return (scale.x == scale.y && scale.x == scale.z) ? scale.x : 1; } 119 112 120 virtual void scale3D(const Vector3& scale); 113 inline void scale3D(const Vector3& scale) 114 { this->setScale3D(this->getScale3D() * scale); } 121 115 inline void scale3D(float x, float y, float z) 122 116 { this->scale3D(Vector3(x, y, z)); } … … 130 124 { return this->children_; } 131 125 132 inline void attachOgreObject(Ogre::MovableObject* object) 133 { this->node_->attachObject(object); } 134 inline void detachOgreObject(Ogre::MovableObject* object) 135 { this->node_->detachObject(object); } 136 inline Ogre::MovableObject* detachOgreObject(const Ogre::String& name) 137 { return this->node_->detachObject(name); } 126 void attachOgreObject(Ogre::MovableObject* object); 127 void detachOgreObject(Ogre::MovableObject* object); 128 Ogre::MovableObject* detachOgreObject(const Ogre::String& name); 138 129 139 130 inline void attachToParent(WorldEntity* parent) … … 241 232 btScalar childrenMass_; 242 233 }; 234 235 // Inline heavily used functions for release builds. In debug, we better avoid including OgreSceneNode here. 236 #ifdef _NDEBUG 237 inline const Vector3& WorldEntity::getPosition() const 238 { return this->node_->getPosition(); } 239 inline const Quaternion& WorldEntity::getOrientation() const 240 { return this->node_->getrOrientation(); } 241 inline const Vector3& WorldEntity::getScale3D(void) const 242 { return this->node_->getScale(); } 243 #endif 243 244 } 244 245
Note: See TracChangeset
for help on using the changeset viewer.