Changeset 2459 for code/branches/presentation/src/orxonox/objects
- Timestamp:
- Dec 15, 2008, 12:53:05 AM (16 years ago)
- Location:
- code/branches/presentation
- Files:
-
- 2 deleted
- 76 edited
- 14 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/CMakeLists.txt
r2171 r2459 13 13 ) 14 14 15 ADD_SOURCE_DIRECTORY(SRC_FILES collisionshapes) 15 16 ADD_SOURCE_DIRECTORY(SRC_FILES controllers) 16 17 ADD_SOURCE_DIRECTORY(SRC_FILES gametypes) -
code/branches/presentation/src/orxonox/objects/Level.cc
- Property svn:mergeinfo changed (with no actual effect on merging)
-
code/branches/presentation/src/orxonox/objects/Level.h
- Property svn:mergeinfo changed (with no actual effect on merging)
-
code/branches/presentation/src/orxonox/objects/Scene.cc
r2371 r2459 22 22 * Author: 23 23 * Fabian 'x3n' Landau 24 * Reto Grieder (physics) 24 25 * Co-authors: 25 26 * ... … … 35 36 #include <OgreLight.h> 36 37 38 #include "BulletCollision/BroadphaseCollision/btAxisSweep3.h" 39 #include "BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h" 40 #include "BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h" 41 #include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h" 42 37 43 #include "core/CoreIncludes.h" 38 44 #include "core/Core.h" 39 45 #include "core/XMLPort.h" 46 #include "tools/BulletConversions.h" 47 #include "objects/worldentities/WorldEntity.h" 40 48 41 49 namespace orxonox … … 69 77 this->rootSceneNode_ = this->sceneManager_->getRootSceneNode(); 70 78 } 79 80 // No physics yet, XMLPort will do that. 81 const int defaultMaxWorldSize = 100000; 82 this->negativeWorldRange_ = Vector3::UNIT_SCALE * -defaultMaxWorldSize; 83 this->positiveWorldRange_ = Vector3::UNIT_SCALE * defaultMaxWorldSize; 84 this->gravity_ = Vector3::ZERO; 85 this->physicalWorld_ = 0; 86 this->solver_ = 0; 87 this->dispatcher_ = 0; 88 this->collisionConfig_ = 0; 89 this->broadphase_ = 0; 71 90 72 91 // test test test … … 91 110 if (Ogre::Root::getSingletonPtr()) 92 111 { 93 // this->sceneManager_->destroySceneNode(this->rootSceneNode_->getName()); // TODO: remove getName() for newer versions of Ogre94 112 Ogre::Root::getSingleton().destroySceneManager(this->sceneManager_); 95 113 } … … 98 116 delete this->sceneManager_; 99 117 } 118 119 this->setPhysicalWorld(false); 100 120 } 101 121 } … … 109 129 XMLPortParam(Scene, "shadow", setShadow, getShadow, xmlelement, mode).defaultValues(true); 110 130 131 XMLPortParam(Scene, "negativeWorldRange", setNegativeWorldRange, getNegativeWorldRange, xmlelement, mode); 132 XMLPortParam(Scene, "positiveWorldRange", setPositiveWorldRange, getPositiveWorldRange, xmlelement, mode); 133 XMLPortParam(Scene, "hasPhysics", setPhysicalWorld, hasPhysics, xmlelement, mode).defaultValues(true); 134 111 135 XMLPortObjectExtended(Scene, BaseObject, "", addObject, getObject, xmlelement, mode, true, false); 112 136 } … … 114 138 void Scene::registerVariables() 115 139 { 116 registerVariable(this->skybox_, variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applySkybox)); 117 registerVariable(this->ambientLight_, variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applyAmbientLight)); 140 registerVariable(this->skybox_, variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applySkybox)); 141 registerVariable(this->ambientLight_, variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_applyAmbientLight)); 142 registerVariable(this->negativeWorldRange_, variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_negativeWorldRange)); 143 registerVariable(this->positiveWorldRange_, variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_positiveWorldRange)); 144 registerVariable(this->gravity_, variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_gravity)); 145 registerVariable(this->bHasPhysics_, variableDirection::toclient, new NetworkCallback<Scene>(this, &Scene::networkcallback_hasPhysics)); 146 } 147 148 void Scene::setNegativeWorldRange(const Vector3& range) 149 { 150 if (range.length() < 10.0f) 151 { 152 CCOUT(2) << "Warning: Setting the negative world range to a very small value: " 153 << omni_cast<std::string>(range) << std::endl; 154 } 155 if (this->hasPhysics()) 156 { 157 CCOUT(2) << "Warning: Attempting to set the physical world range at run time. " 158 << "This causes a complete physical reload which might take some time." << std::endl; 159 this->setPhysicalWorld(false); 160 this->negativeWorldRange_ = range; 161 this->setPhysicalWorld(true); 162 } 163 else 164 this->negativeWorldRange_ = range; 165 } 166 167 void Scene::setPositiveWorldRange(const Vector3& range) 168 { 169 if (range.length() < 10.0f) 170 { 171 CCOUT(2) << "Warning: Setting the positive world range to a very small value: " 172 << omni_cast<std::string>(range) << std::endl; 173 } 174 if (this->hasPhysics()) 175 { 176 CCOUT(2) << "Warning: Attempting to set the physical world range at run time. " 177 << "This causes a complete physical reload which might take some time." << std::endl; 178 this->setPhysicalWorld(false); 179 this->positiveWorldRange_ = range; 180 this->setPhysicalWorld(true); 181 } 182 else 183 this->positiveWorldRange_ = range; 184 } 185 186 void Scene::setGravity(const Vector3& gravity) 187 { 188 this->gravity_ = gravity; 189 if (this->hasPhysics()) 190 this->physicalWorld_->setGravity(omni_cast<btVector3>(this->gravity_)); 191 } 192 193 void Scene::setPhysicalWorld(bool wantPhysics) 194 { 195 this->bHasPhysics_ = wantPhysics; 196 if (wantPhysics && !hasPhysics()) 197 { 198 // Note: These are all little known default classes and values. 199 // It would require further investigation to properly dertermine the right choices. 200 this->broadphase_ = new bt32BitAxisSweep3( 201 omni_cast<btVector3>(this->negativeWorldRange_), omni_cast<btVector3>(this->positiveWorldRange_)); 202 this->collisionConfig_ = new btDefaultCollisionConfiguration(); 203 this->dispatcher_ = new btCollisionDispatcher(this->collisionConfig_); 204 this->solver_ = new btSequentialImpulseConstraintSolver; 205 206 this->physicalWorld_ = new btDiscreteDynamicsWorld(this->dispatcher_, this->broadphase_, this->solver_, this->collisionConfig_); 207 this->physicalWorld_->setGravity(omni_cast<btVector3>(this->gravity_)); 208 } 209 else if (!wantPhysics && hasPhysics()) 210 { 211 // Remove all WorldEntities and shove them to the queue since they would still like to be in a physical world. 212 for (std::set<WorldEntity*>::const_iterator it = this->physicalObjects_.begin(); 213 it != this->physicalObjects_.end(); ++it) 214 { 215 this->physicalWorld_->removeRigidBody((*it)->getPhysicalBody()); 216 this->physicalObjectQueue_.insert(*it); 217 } 218 this->physicalObjects_.clear(); 219 220 delete this->physicalWorld_; 221 delete this->solver_; 222 delete this->dispatcher_; 223 delete this->collisionConfig_; 224 delete this->broadphase_; 225 this->physicalWorld_ = 0; 226 this->solver_ = 0; 227 this->dispatcher_ = 0; 228 this->collisionConfig_ = 0; 229 this->broadphase_ = 0; 230 } 231 } 232 233 void Scene::tick(float dt) 234 { 235 if (!Core::showsGraphics()) 236 { 237 // We need to update the scene nodes if we don't render 238 this->rootSceneNode_->_update(true, false); 239 } 240 if (this->hasPhysics()) 241 { 242 // TODO: This here is bad practice! It will slow down the first tick() by ages. 243 // Rather have an initialise() method as well, called by the Level after everything has been loaded. 244 if (this->physicalObjectQueue_.size() > 0) 245 { 246 // Add all scheduled WorldEntities 247 for (std::set<WorldEntity*>::const_iterator it = this->physicalObjectQueue_.begin(); 248 it != this->physicalObjectQueue_.end(); ++it) 249 { 250 this->physicalWorld_->addRigidBody((*it)->getPhysicalBody()); 251 } 252 this->physicalObjectQueue_.clear(); 253 } 254 255 // Note: 60 means that Bullet will do physics correctly down to 1 frames per seconds. 256 // Under that mark, the simulation will "loose time" and get unusable. 257 physicalWorld_->stepSimulation(dt, 60); 258 } 118 259 } 119 260 … … 165 306 } 166 307 167 void Scene::tick(float dt) 168 { 169 if (!Core::showsGraphics()) 170 { 171 // We need to update the scene nodes if we don't render 172 this->rootSceneNode_->_update(true, false); 173 } 308 void Scene::addPhysicalObject(WorldEntity* object) 309 { 310 if (object) 311 { 312 std::set<WorldEntity*>::iterator it = this->physicalObjects_.find(object); 313 if (it != this->physicalObjects_.end()) 314 return; 315 316 this->physicalObjectQueue_.insert(object); 317 } 318 } 319 320 void Scene::removePhysicalObject(WorldEntity* object) 321 { 322 // check queue first 323 std::set<WorldEntity*>::iterator it = this->physicalObjectQueue_.find(object); 324 if (it != this->physicalObjectQueue_.end()) 325 { 326 this->physicalObjectQueue_.erase(it); 327 return; 328 } 329 330 it = this->physicalObjects_.find(object); 331 if (it == this->physicalObjects_.end()) 332 return; 333 this->physicalObjects_.erase(it); 334 335 if (this->hasPhysics()) 336 this->physicalWorld_->removeRigidBody(object->getPhysicalBody()); 174 337 } 175 338 } -
code/branches/presentation/src/orxonox/objects/Scene.h
r2371 r2459 22 22 * Author: 23 23 * Fabian 'x3n' Landau 24 * Reto Grieder (physics) 24 25 * Co-authors: 25 26 * ... … … 76 77 { this->setAmbientLight(this->ambientLight_); } 77 78 78 Ogre::SceneManager* sceneManager_; 79 Ogre::SceneNode* rootSceneNode_; 80 std::string skybox_; 81 ColourValue ambientLight_; 82 std::list<BaseObject*> objects_; 83 bool bShadows_; 79 Ogre::SceneManager* sceneManager_; 80 Ogre::SceneNode* rootSceneNode_; 81 82 std::string skybox_; 83 ColourValue ambientLight_; 84 std::list<BaseObject*> objects_; 85 bool bShadows_; 86 87 88 ///////////// 89 // Physics // 90 ///////////// 91 92 public: 93 inline bool hasPhysics() 94 { return this->physicalWorld_ != 0; } 95 void setPhysicalWorld(bool wantsPhysics); 96 97 void setNegativeWorldRange(const Vector3& range); 98 inline const Vector3& getNegativeWorldRange() const 99 { return this->negativeWorldRange_; } 100 101 void setPositiveWorldRange(const Vector3& range); 102 inline const Vector3& getPositiveWorldRange() const 103 { return this->positiveWorldRange_; } 104 105 void setGravity(const Vector3& gravity); 106 inline const Vector3& getGravity() const 107 { return this->gravity_; } 108 109 void addPhysicalObject(WorldEntity* object); 110 void removePhysicalObject(WorldEntity* object); 111 112 private: 113 inline void networkcallback_hasPhysics() 114 { this->setPhysicalWorld(this->bHasPhysics_); } 115 inline void networkcallback_negativeWorldRange() 116 { this->setNegativeWorldRange(this->negativeWorldRange_); } 117 inline void networkcallback_positiveWorldRange() 118 { this->setPositiveWorldRange(this->positiveWorldRange_); } 119 inline void networkcallback_gravity() 120 { this->setGravity(this->gravity_); } 121 122 // Bullet objects 123 btDiscreteDynamicsWorld* physicalWorld_; 124 bt32BitAxisSweep3* broadphase_; 125 btDefaultCollisionConfiguration* collisionConfig_; 126 btCollisionDispatcher* dispatcher_; 127 btSequentialImpulseConstraintSolver* solver_; 128 129 std::set<WorldEntity*> physicalObjectQueue_; 130 std::set<WorldEntity*> physicalObjects_; 131 bool bHasPhysics_; 132 Vector3 negativeWorldRange_; 133 Vector3 positiveWorldRange_; 134 Vector3 gravity_; 84 135 }; 85 136 } -
code/branches/presentation/src/orxonox/objects/collisionshapes
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/collisionshapes (added) merged: 2442,2445,2452
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/pickup/Usable.h
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/pickup/Usable.h (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/AddQuest.cc
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/AddQuest.cc (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/AddQuest.h
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/AddQuest.h (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/AddQuestHint.cc
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/AddQuestHint.cc (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/AddQuestHint.h
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/AddQuestHint.h (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/AddReward.cc
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/AddReward.cc (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/AddReward.h
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/AddReward.h (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/ChangeQuestStatus.cc
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/ChangeQuestStatus.cc (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/ChangeQuestStatus.h
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/ChangeQuestStatus.h (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/CompleteQuest.cc
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/CompleteQuest.cc (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/CompleteQuest.h
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/CompleteQuest.h (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/FailQuest.cc
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/FailQuest.cc (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/FailQuest.h
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/FailQuest.h (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/GlobalQuest.cc
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/GlobalQuest.cc (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/GlobalQuest.h
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/GlobalQuest.h (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/LocalQuest.cc
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/LocalQuest.cc (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/LocalQuest.h
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/LocalQuest.h (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/Quest.cc
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/Quest.cc (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/Quest.h
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/Quest.h (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/QuestDescription.cc
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/QuestDescription.cc (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/QuestDescription.h
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/QuestDescription.h (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/QuestEffect.cc
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/QuestEffect.cc (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/QuestEffect.h
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/QuestEffect.h (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/QuestEffectBeacon.cc
r2435 r2459 53 53 Constructor. Registers the object and initializes defaults. 54 54 */ 55 QuestEffectBeacon::QuestEffectBeacon(BaseObject* creator) : PositionableEntity(creator)55 QuestEffectBeacon::QuestEffectBeacon(BaseObject* creator) : StaticEntity(creator) 56 56 { 57 57 RegisterObject(QuestEffectBeacon); -
code/branches/presentation/src/orxonox/objects/quest/QuestEffectBeacon.h
r2435 r2459 37 37 #include "OrxonoxPrereqs.h" 38 38 39 #include "orxonox/objects/worldentities/ PositionableEntity.h"39 #include "orxonox/objects/worldentities/StaticEntity.h" 40 40 41 41 namespace orxonox … … 80 80 Damian 'Mozork' Frick 81 81 */ 82 class _OrxonoxExport QuestEffectBeacon : public PositionableEntity82 class _OrxonoxExport QuestEffectBeacon : public StaticEntity 83 83 { 84 84 public: -
code/branches/presentation/src/orxonox/objects/quest/QuestHint.cc
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/QuestHint.cc (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/QuestHint.h
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/QuestHint.h (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/QuestItem.cc
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/QuestItem.cc (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/QuestItem.h
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/QuestItem.h (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/QuestManager.cc
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/QuestManager.cc (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/QuestManager.h
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/QuestManager.h (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/Rewardable.cc
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/Rewardable.cc (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/quest/Rewardable.h
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/quest/Rewardable.h (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/weaponSystem/WeaponSystem.cc
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/weaponSystem/WeaponSystem.cc (added) merged: 2442 /code/branches/weapon/src/orxonox/objects/WeaponSystem.cc reverse-merged: 2049,2060
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/weaponSystem/WeaponSystem.h
- Property svn:mergeinfo changed
/code/branches/physics/src/orxonox/objects/weaponSystem/WeaponSystem.h (added) merged: 2192 /code/branches/physics_merge/src/orxonox/objects/weaponSystem/WeaponSystem.h (added) merged: 2442
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/worldentities/Backlight.cc
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/worldentities/Backlight.cc (added) merged: 2442 /code/trunk/src/orxonox/objects/worldentities/Backlight.cc (added) merged: 1913-2085
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/worldentities/Backlight.h
- Property svn:mergeinfo changed
r2420 r2459 32 32 #include "OrxonoxPrereqs.h" 33 33 34 #include " PositionableEntity.h"34 #include "StaticEntity.h" 35 35 #include "tools/BillboardSet.h" 36 36 37 37 namespace orxonox 38 38 { 39 class _OrxonoxExport Backlight : public PositionableEntity39 class _OrxonoxExport Backlight : public StaticEntity 40 40 { 41 41 public: -
code/branches/presentation/src/orxonox/objects/worldentities/Billboard.cc
r2371 r2459 30 30 #include "Billboard.h" 31 31 32 #include <OgreBillboardSet.h> 33 32 34 #include "core/CoreIncludes.h" 33 35 #include "core/XMLPort.h" … … 38 40 CreateFactory(Billboard); 39 41 40 Billboard::Billboard(BaseObject* creator) : PositionableEntity(creator)42 Billboard::Billboard(BaseObject* creator) : StaticEntity(creator) 41 43 { 42 44 RegisterObject(Billboard); … … 50 52 { 51 53 if (this->isInitialized() && this->billboard_.getBillboardSet()) 52 this-> getNode()->detachObject(this->billboard_.getName());54 this->detachOgreObject(this->billboard_.getName()); 53 55 } 54 56 } … … 76 78 this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1); 77 79 if (this->billboard_.getBillboardSet()) 78 this->getNode()->attachObject(this->billboard_.getBillboardSet());80 this->attachOgreObject(this->billboard_.getBillboardSet()); 79 81 this->billboard_.setVisible(this->isVisible()); 80 82 } … … 92 94 this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1); 93 95 if (this->billboard_.getBillboardSet()) 94 this-> getNode()->attachObject(this->billboard_.getBillboardSet());96 this->attachOgreObject(this->billboard_.getBillboardSet()); 95 97 this->billboard_.setVisible(this->isVisible()); 96 98 } -
code/branches/presentation/src/orxonox/objects/worldentities/Billboard.h
r2087 r2459 31 31 32 32 #include "OrxonoxPrereqs.h" 33 #include " PositionableEntity.h"33 #include "StaticEntity.h" 34 34 #include "util/Math.h" 35 35 #include "tools/BillboardSet.h" … … 37 37 namespace orxonox 38 38 { 39 class _OrxonoxExport Billboard : public PositionableEntity39 class _OrxonoxExport Billboard : public StaticEntity 40 40 { 41 41 public: -
code/branches/presentation/src/orxonox/objects/worldentities/CMakeLists.txt
r2420 r2459 1 1 SET( SRC_FILES 2 2 WorldEntity.cc 3 PositionableEntity.cc3 StaticEntity.cc 4 4 MovableEntity.cc 5 MobileEntity.cc 5 6 ControllableEntity.cc 6 7 Model.cc -
code/branches/presentation/src/orxonox/objects/worldentities/Camera.cc
- Property svn:mergeinfo changed
r2420 r2459 48 48 CreateFactory(Camera); 49 49 50 Camera::Camera(BaseObject* creator) : PositionableEntity(creator)50 Camera::Camera(BaseObject* creator) : StaticEntity(creator) 51 51 { 52 52 RegisterObject(Camera); … … 56 56 57 57 this->camera_ = this->getScene()->getSceneManager()->createCamera(getUniqueNumberString()); 58 this-> getNode()->attachObject(this->camera_);58 this->attachOgreObject(this->camera_); 59 59 60 60 this->bHasFocus_ = false; -
code/branches/presentation/src/orxonox/objects/worldentities/Camera.h
- Property svn:mergeinfo changed
r2420 r2459 33 33 34 34 #include <OgrePrerequisites.h> 35 #include "objects/worldentities/ PositionableEntity.h"35 #include "objects/worldentities/StaticEntity.h" 36 36 #include "objects/Tickable.h" 37 37 38 38 namespace orxonox 39 39 { 40 class _OrxonoxExport Camera : public PositionableEntity, public Tickable40 class _OrxonoxExport Camera : public StaticEntity, public Tickable 41 41 { 42 42 friend class CameraManager; -
code/branches/presentation/src/orxonox/objects/worldentities/CameraPosition.cc
r2087 r2459 38 38 CreateFactory(CameraPosition); 39 39 40 CameraPosition::CameraPosition(BaseObject* creator) : PositionableEntity(creator)40 CameraPosition::CameraPosition(BaseObject* creator) : StaticEntity(creator) 41 41 { 42 42 RegisterObject(CameraPosition); -
code/branches/presentation/src/orxonox/objects/worldentities/CameraPosition.h
r2087 r2459 32 32 #include "OrxonoxPrereqs.h" 33 33 34 #include "objects/worldentities/ PositionableEntity.h"34 #include "objects/worldentities/StaticEntity.h" 35 35 36 36 namespace orxonox 37 37 { 38 class _OrxonoxExport CameraPosition : public PositionableEntity38 class _OrxonoxExport CameraPosition : public StaticEntity 39 39 { 40 40 public: -
code/branches/presentation/src/orxonox/objects/worldentities/ControllableEntity.cc
r2415 r2459 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * ...25 * Reto Grieder 26 26 * 27 27 */ … … 44 44 CreateFactory(ControllableEntity); 45 45 46 ControllableEntity::ControllableEntity(BaseObject* creator) : WorldEntity(creator)46 ControllableEntity::ControllableEntity(BaseObject* creator) : MobileEntity(creator) 47 47 { 48 48 RegisterObject(ControllableEntity); … … 57 57 this->bDestroyWhenPlayerLeft_ = false; 58 58 59 this-> velocity_= Vector3::ZERO;60 this-> acceleration_= Vector3::ZERO;61 62 this-> server_position_= Vector3::ZERO;63 this-> client_position_ = Vector3::ZERO;64 this-> server_velocity_ = Vector3::ZERO;65 this-> client_velocity_ = Vector3::ZERO;66 this-> server_orientation_ = Quaternion::IDENTITY;67 this->client_orientation_ = Quaternion::IDENTITY; 68 59 this->server_position_ = Vector3::ZERO; 60 this->client_position_ = Vector3::ZERO; 61 this->server_linear_velocity_ = Vector3::ZERO; 62 this->client_linear_velocity_ = Vector3::ZERO; 63 this->server_orientation_ = Quaternion::IDENTITY; 64 this->client_orientation_ = Quaternion::IDENTITY; 65 this->server_angular_velocity_ = Vector3::ZERO; 66 this->client_angular_velocity_ = Vector3::ZERO; 67 68 69 69 this->setPriority( priority::very_high ); 70 71 70 this->registerVariables(); 72 71 } … … 229 228 void ControllableEntity::tick(float dt) 230 229 { 230 MobileEntity::tick(dt); 231 231 232 if (this->isActive()) 232 233 { 233 this->velocity_ += (dt * this->acceleration_); 234 this->node_->translate(dt * this->velocity_, Ogre::Node::TS_LOCAL); 235 236 if (Core::isMaster()) 234 // Check whether Bullet doesn't do the physics for us 235 if (!this->isDynamic()) 237 236 { 238 this->server_velocity_ = this->velocity_; 239 this->server_position_ = this->node_->getPosition(); 237 if (Core::isMaster()) 238 { 239 this->server_position_ = this->getPosition(); 240 this->server_orientation_ = this->getOrientation(); 241 this->server_linear_velocity_ = this->getVelocity(); 242 this->server_angular_velocity_ = this->getAngularVelocity(); 243 } 244 else if (this->bControlled_) 245 { 246 this->client_position_ = this->getPosition(); 247 this->client_orientation_ = this->getOrientation(); 248 this->client_linear_velocity_ = this->getVelocity(); 249 this->client_angular_velocity_ = this->getAngularVelocity(); 250 } 240 251 } 241 else if (this->bControlled_)242 {243 // COUT(2) << "setting client position" << endl;244 this->client_velocity_ = this->velocity_;245 this->client_position_ = this->node_->getPosition();246 }247 252 } 248 253 } … … 251 256 { 252 257 registerVariable(this->cameraPositionTemplate_, variableDirection::toclient); 253 254 registerVariable(this->client_overwrite_, variableDirection::toserver); 255 256 registerVariable(this->server_position_, variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition)); 257 registerVariable(this->server_velocity_, variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerVelocity)); 258 registerVariable(this->server_orientation_, variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation)); 259 registerVariable(this->server_overwrite_, variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite)); 260 261 registerVariable(this->client_position_, variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientPosition)); 262 registerVariable(this->client_velocity_, variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientVelocity)); 263 registerVariable(this->client_orientation_, variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientOrientation)); 264 265 266 registerVariable(this->playerID_, variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::networkcallback_changedplayerID)); 258 259 registerVariable(this->server_position_, variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition)); 260 registerVariable(this->server_linear_velocity_, variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerLinearVelocity)); 261 registerVariable(this->server_orientation_, variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation)); 262 registerVariable(this->server_angular_velocity_, variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerAngularVelocity)); 263 264 registerVariable(this->server_overwrite_, variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite)); 265 registerVariable(this->client_overwrite_, variableDirection::toserver); 266 267 registerVariable(this->client_position_, variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientPosition)); 268 registerVariable(this->client_linear_velocity_, variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientLinearVelocity)); 269 registerVariable(this->client_orientation_, variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientOrientation)); 270 registerVariable(this->client_angular_velocity_, variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientAngularVelocity)); 271 272 registerVariable(this->playerID_, variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::networkcallback_changedplayerID)); 267 273 } 268 274 … … 270 276 { 271 277 if (!this->bControlled_) 272 this-> node_->setPosition(this->server_position_);273 } 274 275 void ControllableEntity::processServer Velocity()278 this->setPosition(this->server_position_); 279 } 280 281 void ControllableEntity::processServerLinearVelocity() 276 282 { 277 283 if (!this->bControlled_) 278 this-> velocity_ = this->server_velocity_;284 this->setVelocity(this->server_linear_velocity_); 279 285 } 280 286 … … 282 288 { 283 289 if (!this->bControlled_) 284 this->node_->setOrientation(this->server_orientation_); 290 this->setOrientation(this->server_orientation_); 291 } 292 293 void ControllableEntity::processServerAngularVelocity() 294 { 295 if (!this->bControlled_) 296 this->setAngularVelocity(this->server_angular_velocity_); 285 297 } 286 298 … … 290 302 { 291 303 this->setPosition(this->server_position_); 292 this->setVelocity(this->server_velocity_);293 304 this->setOrientation(this->server_orientation_); 305 this->setVelocity(this->server_linear_velocity_); 306 this->setAngularVelocity(this->server_angular_velocity_); 294 307 295 308 this->client_overwrite_ = this->server_overwrite_; … … 301 314 if (this->server_overwrite_ == this->client_overwrite_) 302 315 { 303 // COUT(2) << "callback: setting client position" << endl; 304 this->node_->setPosition(this->client_position_); 305 this->server_position_ = this->client_position_; 306 } 307 // else 308 // COUT(2) << "callback: not setting client position" << endl; 309 } 310 311 void ControllableEntity::processClientVelocity() 316 this->setPosition(this->client_position_); 317 // The call above increments the overwrite. This is not desired to reduce traffic 318 --this->server_overwrite_; 319 } 320 } 321 322 void ControllableEntity::processClientLinearVelocity() 312 323 { 313 324 if (this->server_overwrite_ == this->client_overwrite_) 314 325 { 315 this->velocity_ = this->client_velocity_; 316 this->server_velocity_ = this->client_velocity_; 326 this->setVelocity(this->client_linear_velocity_); 327 // The call above increments the overwrite. This is not desired to reduce traffic 328 --this->server_overwrite_; 317 329 } 318 330 } … … 322 334 if (this->server_overwrite_ == this->client_overwrite_) 323 335 { 324 this->node_->setOrientation(this->client_orientation_); 325 this->server_orientation_ = this->client_orientation_; 326 } 327 } 328 336 this->setOrientation(this->client_orientation_); 337 // The call above increments the overwrite. This is not desired to reduce traffic 338 --this->server_overwrite_; 339 } 340 } 341 342 void ControllableEntity::processClientAngularVelocity() 343 { 344 if (this->server_overwrite_ == this->client_overwrite_) 345 { 346 this->setAngularVelocity(this->client_angular_velocity_); 347 // The call above increments the overwrite. This is not desired to reduce traffic 348 --this->server_overwrite_; 349 } 350 } 329 351 330 352 void ControllableEntity::setPosition(const Vector3& position) … … 332 354 if (Core::isMaster()) 333 355 { 334 this->node_->setPosition(position);335 this->server_position_ = position;356 MobileEntity::setPosition(position); 357 this->server_position_ = this->getPosition(); 336 358 ++this->server_overwrite_; 337 359 } 338 360 else if (this->bControlled_) 339 361 { 340 this->node_->setPosition(position); 341 this->client_position_ = position; 362 MobileEntity::setPosition(position); 363 this->client_position_ = this->getPosition(); 364 } 365 } 366 367 void ControllableEntity::setOrientation(const Quaternion& orientation) 368 { 369 if (Core::isMaster()) 370 { 371 MobileEntity::setOrientation(orientation); 372 this->server_orientation_ = this->getOrientation(); 373 ++this->server_overwrite_; 374 } 375 else if (this->bControlled_) 376 { 377 MobileEntity::setOrientation(orientation); 378 this->client_orientation_ = this->getOrientation(); 342 379 } 343 380 } … … 347 384 if (Core::isMaster()) 348 385 { 349 this->velocity_ = velocity;350 this->server_ velocity_ = velocity;386 MobileEntity::setVelocity(velocity); 387 this->server_linear_velocity_ = this->getVelocity(); 351 388 ++this->server_overwrite_; 352 389 } 353 390 else if (this->bControlled_) 354 391 { 355 this->velocity_ = velocity;356 this->client_ velocity_ = velocity;357 } 358 } 359 360 void ControllableEntity:: translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo)392 MobileEntity::setVelocity(velocity); 393 this->client_linear_velocity_ = this->getVelocity(); 394 } 395 } 396 397 void ControllableEntity::setAngularVelocity(const Vector3& velocity) 361 398 { 362 399 if (Core::isMaster()) 363 400 { 364 this->node_->translate(distance, relativeTo);365 this->server_ position_ = this->node_->getPosition();401 MobileEntity::setAngularVelocity(velocity); 402 this->server_angular_velocity_ = this->getAngularVelocity(); 366 403 ++this->server_overwrite_; 367 404 } 368 405 else if (this->bControlled_) 369 406 { 370 this->node_->translate(distance, relativeTo); 371 this->client_position_ = this->node_->getPosition(); 372 } 373 } 374 375 void ControllableEntity::setOrientation(const Quaternion& orientation) 376 { 407 MobileEntity::setAngularVelocity(velocity); 408 this->client_angular_velocity_ = this->getAngularVelocity(); 409 } 410 } 411 412 void ControllableEntity::setWorldTransform(const btTransform& worldTrans) 413 { 414 MobileEntity::setWorldTransform(worldTrans); 377 415 if (Core::isMaster()) 378 416 { 379 this->node_->setOrientation(orientation); 380 this->server_orientation_ = orientation; 381 ++this->server_overwrite_; 417 this->server_position_ = this->getPosition(); 418 this->server_orientation_ = this->getOrientation(); 419 this->server_linear_velocity_ = this->getVelocity(); 420 this->server_angular_velocity_ = this->getAngularVelocity(); 382 421 } 383 422 else if (this->bControlled_) 384 423 { 385 this->node_->setOrientation(orientation); 386 this->client_orientation_ = orientation; 387 } 388 } 389 390 void ControllableEntity::rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo) 391 { 392 if (Core::isMaster()) 393 { 394 this->node_->rotate(rotation, relativeTo); 395 this->server_orientation_ = this->node_->getOrientation(); 396 ++this->server_overwrite_; 397 } 398 else if (this->bControlled_) 399 { 400 this->node_->rotate(rotation, relativeTo); 401 this->client_orientation_ = this->node_->getOrientation(); 402 } 403 } 404 405 void ControllableEntity::yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo) 406 { 407 if (Core::isMaster()) 408 { 409 this->node_->yaw(angle, relativeTo); 410 this->server_orientation_ = this->node_->getOrientation(); 411 ++this->server_overwrite_; 412 } 413 else if (this->bControlled_) 414 { 415 this->node_->yaw(angle, relativeTo); 416 this->client_orientation_ = this->node_->getOrientation(); 417 } 418 } 419 420 void ControllableEntity::pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo) 421 { 422 if (Core::isMaster()) 423 { 424 this->node_->pitch(angle, relativeTo); 425 this->server_orientation_ = this->node_->getOrientation(); 426 ++this->server_overwrite_; 427 } 428 else if (this->bControlled_) 429 { 430 this->node_->pitch(angle, relativeTo); 431 this->client_orientation_ = this->node_->getOrientation(); 432 } 433 } 434 435 void ControllableEntity::roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo) 436 { 437 if (Core::isMaster()) 438 { 439 this->node_->roll(angle, relativeTo); 440 this->server_orientation_ = this->node_->getOrientation(); 441 ++this->server_overwrite_; 442 } 443 else if (this->bControlled_) 444 { 445 this->node_->roll(angle, relativeTo); 446 this->client_orientation_ = this->node_->getOrientation(); 447 } 448 } 449 450 void ControllableEntity::lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector) 451 { 452 if (Core::isMaster()) 453 { 454 this->node_->lookAt(target, relativeTo, localDirectionVector); 455 this->server_orientation_ = this->node_->getOrientation(); 456 ++this->server_overwrite_; 457 } 458 else if (this->bControlled_) 459 { 460 this->node_->lookAt(target, relativeTo, localDirectionVector); 461 this->client_orientation_ = this->node_->getOrientation(); 462 } 463 } 464 465 void ControllableEntity::setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector) 466 { 467 if (Core::isMaster()) 468 { 469 this->node_->setDirection(direction, relativeTo, localDirectionVector); 470 this->server_orientation_ = this->node_->getOrientation(); 471 ++this->server_overwrite_; 472 } 473 else if (this->bControlled_) 474 { 475 this->node_->setDirection(direction, relativeTo, localDirectionVector); 476 this->client_orientation_ = this->node_->getOrientation(); 424 this->client_position_ = this->getPosition(); 425 this->client_orientation_ = this->getOrientation(); 426 this->client_linear_velocity_ = this->getVelocity(); 427 this->client_angular_velocity_ = this->getAngularVelocity(); 477 428 } 478 429 } -
code/branches/presentation/src/orxonox/objects/worldentities/ControllableEntity.h
r2087 r2459 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" 36 35 37 36 namespace orxonox 38 37 { 39 class _OrxonoxExport ControllableEntity : public WorldEntity, public Tickable38 class _OrxonoxExport ControllableEntity : public MobileEntity 40 39 { 41 40 public: … … 72 71 virtual void switchCamera(); 73 72 74 inline const Vector3& getVelocity() const75 { return this->velocity_; }76 inline const Vector3& getAcceleration() const77 { return this->acceleration_; }78 73 inline const std::string& getHudTemplate() const 79 74 { 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 75 110 76 inline Camera* getCamera() const … … 123 89 { return this->cameraPositionTemplate_; } 124 90 91 using WorldEntity::setPosition; 92 using WorldEntity::setOrientation; 93 using MobileEntity::setVelocity; 94 using MobileEntity::setAngularVelocity; 95 96 void setPosition(const Vector3& position); 97 void setOrientation(const Quaternion& orientation); 98 void setVelocity(const Vector3& velocity); 99 void setAngularVelocity(const Vector3& velocity); 100 125 101 protected: 126 102 virtual void startLocalControl(); … … 133 109 { return this->bControlled_; } 134 110 135 Vector3 acceleration_;136 137 111 private: 138 112 void overwrite(); … … 140 114 141 115 void processServerPosition(); 142 void processServer Velocity();116 void processServerLinearVelocity(); 143 117 void processServerOrientation(); 118 void processServerAngularVelocity(); 144 119 145 120 void processClientPosition(); 146 void processClient Velocity();121 void processClientLinearVelocity(); 147 122 void processClientOrientation(); 123 void processClientAngularVelocity(); 148 124 149 125 void networkcallback_changedplayerID(); 126 127 // Bullet btMotionState related 128 void setWorldTransform(const btTransform& worldTrans); 150 129 151 130 unsigned int server_overwrite_; 152 131 unsigned int client_overwrite_; 153 132 154 Vector3 velocity_;155 156 133 bool bControlled_; 157 134 Vector3 server_position_; 158 135 Vector3 client_position_; 159 Vector3 server_ velocity_;160 Vector3 client_ velocity_;136 Vector3 server_linear_velocity_; 137 Vector3 client_linear_velocity_; 161 138 Quaternion server_orientation_; 162 139 Quaternion client_orientation_; 140 Vector3 server_angular_velocity_; 141 Vector3 client_angular_velocity_; 163 142 164 143 PlayerInfo* player_; -
code/branches/presentation/src/orxonox/objects/worldentities/Light.cc
r2371 r2459 47 47 CreateFactory(Light); 48 48 49 Light::Light(BaseObject* creator) : PositionableEntity(creator)49 Light::Light(BaseObject* creator) : StaticEntity(creator) 50 50 { 51 51 RegisterObject(Light); … … 53 53 if (this->getScene() && this->getScene()->getSceneManager()) 54 54 this->light_ = this->getScene()->getSceneManager()->createLight("Light" + convertToString(Light::lightCounter_s++)); 55 this-> getNode()->attachObject(this->light_);55 this->attachOgreObject(this->light_); 56 56 57 57 this->registerVariables(); -
code/branches/presentation/src/orxonox/objects/worldentities/Light.h
r2087 r2459 31 31 32 32 #include "OrxonoxPrereqs.h" 33 #include " PositionableEntity.h"33 #include "StaticEntity.h" 34 34 35 35 #include <string> … … 40 40 namespace orxonox 41 41 { 42 class _OrxonoxExport Light : public PositionableEntity42 class _OrxonoxExport Light : public StaticEntity 43 43 { 44 44 public: -
code/branches/presentation/src/orxonox/objects/worldentities/Model.cc
r2415 r2459 29 29 #include "OrxonoxStableHeaders.h" 30 30 31 #include <OgreEntity.h> 31 32 #include "Model.h" 32 33 #include "core/CoreIncludes.h" … … 38 39 CreateFactory(Model); 39 40 40 Model::Model(BaseObject* creator) : PositionableEntity(creator)41 Model::Model(BaseObject* creator) : StaticEntity(creator) 41 42 { 42 43 RegisterObject(Model); … … 48 49 { 49 50 if (this->isInitialized() && this->mesh_.getEntity()) 50 this-> getNode()->detachObject(this->mesh_.getEntity());51 this->detachOgreObject(this->mesh_.getEntity()); 51 52 } 52 53 … … 68 69 { 69 70 if (this->mesh_.getEntity()) 70 this-> getNode()->detachObject(this->mesh_.getEntity());71 this->detachOgreObject(this->mesh_.getEntity()); 71 72 72 73 this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_); … … 74 75 if (this->mesh_.getEntity()) 75 76 { 76 this-> getNode()->attachObject(this->mesh_.getEntity());77 this->attachOgreObject(this->mesh_.getEntity()); 77 78 this->mesh_.getEntity()->setCastShadows(this->bCastShadows_); 78 79 this->mesh_.setVisible(this->isVisible()); -
code/branches/presentation/src/orxonox/objects/worldentities/Model.h
r2087 r2459 31 31 32 32 #include "OrxonoxPrereqs.h" 33 #include " PositionableEntity.h"33 #include "StaticEntity.h" 34 34 #include "tools/Mesh.h" 35 35 36 36 namespace orxonox 37 37 { 38 class _OrxonoxExport Model : public PositionableEntity38 class _OrxonoxExport Model : public StaticEntity 39 39 { 40 40 public: … … 70 70 } 71 71 72 #endif /* _ PositionableEntity_H__ */72 #endif /* _Model_H__ */ -
code/branches/presentation/src/orxonox/objects/worldentities/MovableEntity.cc
r2415 r2459 22 22 * Author: 23 23 * Fabian 'x3n' Landau 24 * Reto Grieder 24 25 * Co-authors: 25 26 * ... … … 38 39 { 39 40 static const float MAX_RESYNCHRONIZE_TIME = 3.0f; 41 static const float CONTINUOUS_SYNCHRONIZATION_TIME = 10.0f; 40 42 41 43 CreateFactory(MovableEntity); 42 44 43 MovableEntity::MovableEntity(BaseObject* creator) : WorldEntity(creator)45 MovableEntity::MovableEntity(BaseObject* creator) : MobileEntity(creator) 44 46 { 45 47 RegisterObject(MovableEntity); 46 48 47 this->velocity_ = Vector3::ZERO; 48 this->acceleration_ = Vector3::ZERO; 49 this->rotationAxis_ = Vector3::ZERO; 50 this->rotationRate_ = 0; 51 this->momentum_ = 0; 52 53 this->overwrite_position_ = Vector3::ZERO; 49 this->overwrite_position_ = Vector3::ZERO; 54 50 this->overwrite_orientation_ = Quaternion::IDENTITY; 55 51 56 52 this->setPriority( priority::low ); 53 54 // Resynchronise every few seconds because we only work with velocities (no positions) 55 continuousResynchroTimer_ = new Timer<MovableEntity>(CONTINUOUS_SYNCHRONIZATION_TIME + rnd(-1, 1), 56 true, this, createExecutor(createFunctor(&MovableEntity::resynchronize)), false); 57 57 58 58 this->registerVariables(); … … 61 61 MovableEntity::~MovableEntity() 62 62 { 63 if (this->isInitialized()) 64 delete this->continuousResynchroTimer_; 63 65 } 64 66 … … 66 68 { 67 69 SUPER(MovableEntity, XMLPort, xmlelement, mode); 68 69 XMLPortParamTemplate(MovableEntity, "velocity", setVelocity, getVelocity, xmlelement, mode, const Vector3&);70 XMLPortParamTemplate(MovableEntity, "rotationaxis", setRotationAxis, getRotationAxis, xmlelement, mode, const Vector3&);71 XMLPortParamTemplate(MovableEntity, "rotationrate", setRotationRate, getRotationRate, xmlelement, mode, const Degree&);72 }73 74 void MovableEntity::tick(float dt)75 {76 if (this->isActive())77 {78 this->velocity_ += (dt * this->acceleration_);79 this->node_->translate(dt * this->velocity_);80 81 this->rotationRate_ += (dt * this->momentum_);82 this->node_->rotate(this->rotationAxis_, this->rotationRate_ * dt);83 }84 70 } 85 71 86 72 void MovableEntity::registerVariables() 87 73 { 88 registerVariable(this->velocity_.x, variableDirection::toclient); 89 registerVariable(this->velocity_.y, variableDirection::toclient); 90 registerVariable(this->velocity_.z, variableDirection::toclient); 91 92 registerVariable(this->rotationAxis_.x, variableDirection::toclient); 93 registerVariable(this->rotationAxis_.y, variableDirection::toclient); 94 registerVariable(this->rotationAxis_.z, variableDirection::toclient); 95 96 registerVariable(this->rotationRate_, variableDirection::toclient); 97 74 registerVariable(this->linearVelocity_, variableDirection::toclient, new NetworkCallback<MovableEntity>(this, &MovableEntity::processLinearVelocity)); 75 registerVariable(this->angularVelocity_, variableDirection::toclient, new NetworkCallback<MovableEntity>(this, &MovableEntity::processAngularVelocity)); 76 98 77 registerVariable(this->overwrite_position_, variableDirection::toclient, new NetworkCallback<MovableEntity>(this, &MovableEntity::overwritePosition)); 99 78 registerVariable(this->overwrite_orientation_, variableDirection::toclient, new NetworkCallback<MovableEntity>(this, &MovableEntity::overwriteOrientation)); 100 }101 102 void MovableEntity::overwritePosition()103 {104 this->node_->setPosition(this->overwrite_position_);105 }106 107 void MovableEntity::overwriteOrientation()108 {109 this->node_->setOrientation(this->overwrite_orientation_);110 79 } 111 80 … … 124 93 this->overwrite_orientation_ = this->getOrientation(); 125 94 } 126 127 void MovableEntity::setPosition(const Vector3& position)128 {129 this->node_->setPosition(position);130 this->overwrite_position_ = this->node_->getPosition();131 }132 133 void MovableEntity::translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo)134 {135 this->node_->translate(distance, relativeTo);136 this->overwrite_position_ = this->node_->getPosition();137 }138 139 void MovableEntity::setOrientation(const Quaternion& orientation)140 {141 this->node_->setOrientation(orientation);142 this->overwrite_orientation_ = this->node_->getOrientation();143 }144 145 void MovableEntity::rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo)146 {147 this->node_->rotate(rotation, relativeTo);148 this->overwrite_orientation_ = this->node_->getOrientation();149 }150 151 void MovableEntity::yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo)152 {153 this->node_->yaw(angle, relativeTo);154 this->overwrite_orientation_ = this->node_->getOrientation();155 }156 157 void MovableEntity::pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo)158 {159 this->node_->pitch(angle, relativeTo);160 this->overwrite_orientation_ = this->node_->getOrientation();161 }162 163 void MovableEntity::roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo)164 {165 this->node_->roll(angle, relativeTo);166 this->overwrite_orientation_ = this->node_->getOrientation();167 }168 169 void MovableEntity::lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)170 {171 this->node_->lookAt(target, relativeTo, localDirectionVector);172 this->overwrite_orientation_ = this->node_->getOrientation();173 }174 175 void MovableEntity::setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)176 {177 this->node_->setDirection(direction, relativeTo, localDirectionVector);178 this->overwrite_orientation_ = this->node_->getOrientation();179 }180 95 } -
code/branches/presentation/src/orxonox/objects/worldentities/MovableEntity.h
r2171 r2459 22 22 * Author: 23 23 * Fabian 'x3n' Landau 24 * Reto Grieder 24 25 * Co-authors: 25 26 * ... … … 32 33 #include "OrxonoxPrereqs.h" 33 34 34 #include "WorldEntity.h" 35 #include "objects/Tickable.h" 35 #include "MobileEntity.h" 36 36 #include "network/ClientConnectionListener.h" 37 37 38 38 namespace orxonox 39 39 { 40 class _OrxonoxExport MovableEntity : public WorldEntity, public Tickable, public ClientConnectionListener40 class _OrxonoxExport MovableEntity : public MobileEntity, public ClientConnectionListener 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 49 using WorldEntity::setPosition; 51 using WorldEntity::translate;52 50 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;59 51 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); 69 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_; } 76 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_; } 52 inline void setPosition(const Vector3& position) 53 { MobileEntity::setPosition(position); this->overwrite_position_ = this->getPosition(); } 54 inline void setOrientation(const Quaternion& orientation) 55 { MobileEntity::setOrientation(orientation); this->overwrite_orientation_ = this->getOrientation(); } 104 56 105 57 private: … … 108 60 void resynchronize(); 109 61 110 void overwritePosition(); 111 void overwriteOrientation(); 62 inline void processLinearVelocity() 63 { this->setVelocity(this->linearVelocity_); } 64 inline void processAngularVelocity() 65 { this->setAngularVelocity(this->angularVelocity_); } 112 66 113 Vector3 velocity_; 114 Vector3 acceleration_; 115 Vector3 rotationAxis_; 116 Degree rotationRate_; 117 Degree momentum_; 67 inline void overwritePosition() 68 { this->setPosition(this->overwrite_position_); } 69 inline void overwriteOrientation() 70 { this->setOrientation(this->overwrite_orientation_); } 118 71 119 Vector3 overwrite_position_;72 Vector3 overwrite_position_; 120 73 Quaternion overwrite_orientation_; 74 Timer<MovableEntity>* continuousResynchroTimer_; 121 75 }; 122 76 } -
code/branches/presentation/src/orxonox/objects/worldentities/ParticleEmitter.cc
r2371 r2459 33 33 34 34 #include "OrxonoxStableHeaders.h" 35 #include "ParticleEmitter.h" 35 36 36 #include "ParticleEmitter.h"37 #include <OgreParticleSystem.h> 37 38 38 39 #include "tools/ParticleInterface.h" … … 46 47 CreateFactory(ParticleEmitter); 47 48 48 ParticleEmitter::ParticleEmitter(BaseObject* creator) : PositionableEntity(creator)49 ParticleEmitter::ParticleEmitter(BaseObject* creator) : StaticEntity(creator) 49 50 { 50 51 RegisterObject(ParticleEmitter); … … 62 63 { 63 64 if (this->isInitialized() && this->particles_) 65 { 66 this->detachOgreObject(this->particles_->getParticleSystem()); 64 67 delete this->particles_; 68 } 65 69 } 66 70 … … 105 109 { 106 110 this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), this->source_, this->LOD_); 107 this-> particles_->addToSceneNode(this->getNode());111 this->attachOgreObject(particles_->getParticleSystem()); 108 112 this->particles_->setVisible(this->isVisible()); 109 113 this->particles_->setEnabled(this->isActive()); -
code/branches/presentation/src/orxonox/objects/worldentities/ParticleEmitter.h
r2087 r2459 31 31 32 32 #include "OrxonoxPrereqs.h" 33 #include " PositionableEntity.h"33 #include "StaticEntity.h" 34 34 35 35 namespace orxonox 36 36 { 37 class _OrxonoxExport ParticleEmitter : public PositionableEntity37 class _OrxonoxExport ParticleEmitter : public StaticEntity 38 38 { 39 39 public: -
code/branches/presentation/src/orxonox/objects/worldentities/ParticleSpawner.cc
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/worldentities/ParticleSpawner.cc (added) merged: 2442 /code/trunk/src/orxonox/objects/worldentities/ParticleSpawner.cc (added) merged: 1913-2085
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/worldentities/ParticleSpawner.h
- Property svn:mergeinfo changed
/code/branches/physics_merge/src/orxonox/objects/worldentities/ParticleSpawner.h (added) merged: 2442 /code/trunk/src/orxonox/objects/worldentities/ParticleSpawner.h (added) merged: 1913-2085
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/worldentities/Planet.cc
r2436 r2459 33 33 34 34 #include <OgreEntity.h> 35 #include <Ogre Mesh.h>35 #include <OgreBillboardSet.h> 36 36 #include <OgreHardwareVertexBuffer.h> 37 37 #include <OgreMeshManager.h> … … 63 63 { 64 64 if (this->isInitialized() && this->mesh_.getEntity()) 65 this-> getNode()->detachObject(this->mesh_.getEntity());65 this->detachOgreObject(this->mesh_.getEntity()); 66 66 } 67 67 … … 108 108 billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->atmosphere_, Vector3(0,0,0)); 109 109 110 this-> getNode()->attachObject(this->billboard_.getBillboardSet());110 this->attachOgreObject(this->billboard_.getBillboardSet()); 111 111 this->billboard_.getBillboardSet()->setUseAccurateFacing(true); 112 112 this->setCastShadows(true); … … 118 118 { 119 119 if (this->mesh_.getEntity()) 120 this-> getNode()->detachObject(this->mesh_.getEntity());120 this->detachOgreObject(this->mesh_.getEntity()); 121 121 122 122 this->mesh_.setMeshSource(this->getScene()->getSceneManager(), this->meshSrc_); … … 124 124 if (this->mesh_.getEntity()) 125 125 { 126 this-> getNode()->attachObject(this->mesh_.getEntity());126 this->attachOgreObject(this->mesh_.getEntity()); 127 127 this->mesh_.getEntity()->setCastShadows(this->bCastShadows_); 128 128 this->mesh_.setVisible(this->isVisible()); -
code/branches/presentation/src/orxonox/objects/worldentities/Planet.h
r2436 r2459 31 31 32 32 #include "OrxonoxPrereqs.h" 33 34 #include <OgreMesh.h> 33 35 34 36 #include "tools/BillboardSet.h" -
code/branches/presentation/src/orxonox/objects/worldentities/SpawnPoint.cc
r2087 r2459 38 38 CreateFactory(SpawnPoint); 39 39 40 SpawnPoint::SpawnPoint(BaseObject* creator) : PositionableEntity(creator)40 SpawnPoint::SpawnPoint(BaseObject* creator) : StaticEntity(creator) 41 41 { 42 42 RegisterObject(SpawnPoint); -
code/branches/presentation/src/orxonox/objects/worldentities/SpawnPoint.h
r2087 r2459 34 34 #include "core/Identifier.h" 35 35 #include "core/Template.h" 36 #include "PositionableEntity.h"37 36 #include "objects/worldentities/pawns/Pawn.h" 37 #include "objects/worldentities/StaticEntity.h" 38 38 39 39 namespace orxonox 40 40 { 41 class _OrxonoxExport SpawnPoint : public PositionableEntity41 class _OrxonoxExport SpawnPoint : public StaticEntity 42 42 { 43 43 public: -
code/branches/presentation/src/orxonox/objects/worldentities/WorldEntity.cc
r2371 r2459 22 22 * Author: 23 23 * Fabian 'x3n' Landau 24 * Reto Grieder (physics) 24 25 * Co-authors: 25 26 * ... … … 31 32 32 33 #include <cassert> 34 #include <OgreSceneNode.h> 33 35 #include <OgreSceneManager.h> 34 36 #include "BulletDynamics/Dynamics/btRigidBody.h" 37 38 #include "util/Exception.h" 39 #include "util/Convert.h" 35 40 #include "core/CoreIncludes.h" 36 41 #include "core/XMLPort.h" 37 #include "util/Convert.h"38 #include "util/Exception.h"39 42 40 43 #include "objects/Scene.h" 44 #include "objects/collisionshapes/CompoundCollisionShape.h" 41 45 42 46 namespace orxonox … … 64 68 this->node_->setOrientation(Quaternion::IDENTITY); 65 69 70 // Default behaviour does not include physics 71 this->physicalBody_ = 0; 72 this->bPhysicsActive_ = false; 73 this->collisionShape_ = new CompoundCollisionShape(this); 74 this->collisionType_ = None; 75 this->collisionTypeSynchronised_ = None; 76 this->mass_ = 0; 77 this->childrenMass_ = 0; 78 // Use bullet default values 79 this->restitution_ = 0; 80 this->angularFactor_ = 1; 81 this->linearDamping_ = 0; 82 this->angularDamping_ = 0; 83 this->friction_ = 0.5; 84 66 85 this->registerVariables(); 67 86 } … … 74 93 if (this->getScene()->getSceneManager()) 75 94 this->getScene()->getSceneManager()->destroySceneNode(this->node_->getName()); 95 96 // TODO: Detach from parent and detach all children. 97 98 if (this->physicalBody_) 99 { 100 this->deactivatePhysics(); 101 delete this->physicalBody_; 102 } 103 delete this->collisionShape_; 76 104 } 77 105 } … … 81 109 SUPER(WorldEntity, XMLPort, xmlelement, mode); 82 110 83 XMLPortParamTemplate(WorldEntity, "position", setPosition, getPosition,xmlelement, mode, const Vector3&);111 XMLPortParamTemplate(WorldEntity, "position", setPosition, getPosition, xmlelement, mode, const Vector3&); 84 112 XMLPortParamTemplate(WorldEntity, "orientation", setOrientation, getOrientation, xmlelement, mode, const Quaternion&); 85 XMLPortParamLoadOnly(WorldEntity, "lookat", lookAt_xmlport, xmlelement, mode); 86 XMLPortParamLoadOnly(WorldEntity, "direction", setDirection_xmlport, xmlelement, mode); 87 XMLPortParamLoadOnly(WorldEntity, "yaw", yaw_xmlport, xmlelement, mode); 88 XMLPortParamLoadOnly(WorldEntity, "pitch", pitch_xmlport, xmlelement, mode); 89 XMLPortParamLoadOnly(WorldEntity, "roll", roll_xmlport, xmlelement, mode); 90 XMLPortParamTemplate(WorldEntity, "scale3D", setScale3D, getScale3D, xmlelement, mode, const Vector3&); 91 XMLPortParam(WorldEntity, "scale", setScale, getScale, xmlelement, mode); 92 113 XMLPortParamTemplate(WorldEntity, "scale3D", setScale3D, getScale3D, xmlelement, mode, const Vector3&); 114 XMLPortParam (WorldEntity, "scale", setScale, getScale, xmlelement, mode); 115 XMLPortParamLoadOnly(WorldEntity, "lookat", lookAt_xmlport, xmlelement, mode); 116 XMLPortParamLoadOnly(WorldEntity, "direction", setDirection_xmlport, xmlelement, mode); 117 XMLPortParamLoadOnly(WorldEntity, "yaw", yaw_xmlport, xmlelement, mode); 118 XMLPortParamLoadOnly(WorldEntity, "pitch", pitch_xmlport, xmlelement, mode); 119 XMLPortParamLoadOnly(WorldEntity, "roll", roll_xmlport, xmlelement, mode); 120 121 // Physics 122 XMLPortParam(WorldEntity, "collisionType", setCollisionTypeStr, getCollisionTypeStr, xmlelement, mode); 123 XMLPortParam(WorldEntity, "mass", setMass, getMass, xmlelement, mode); 124 XMLPortParam(WorldEntity, "restitution", setRestitution, getRestitution, xmlelement, mode); 125 XMLPortParam(WorldEntity, "angularFactor", setAngularFactor, getAngularFactor, xmlelement, mode); 126 XMLPortParam(WorldEntity, "linearDamping", setLinearDamping, getLinearDamping, xmlelement, mode); 127 XMLPortParam(WorldEntity, "angularDamping", setAngularDamping, getAngularDamping, xmlelement, mode); 128 XMLPortParam(WorldEntity, "friction", setFriction, getFriction, xmlelement, mode); 129 130 // Other attached WorldEntities 93 131 XMLPortObject(WorldEntity, WorldEntity, "attached", attach, getAttachedObject, xmlelement, mode); 132 // Attached collision shapes 133 XMLPortObject(WorldEntity, CollisionShape, "collisionShapes", attachCollisionShape, getAttachedCollisionShape, xmlelement, mode); 94 134 } 95 135 96 136 void WorldEntity::registerVariables() 97 137 { 98 registerVariable(this->bActive_, variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedActivity)); 99 registerVariable(this->bVisible_, variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedVisibility)); 100 101 registerVariable(this->getScale3D().x, variableDirection::toclient); 102 registerVariable(this->getScale3D().y, variableDirection::toclient); 103 registerVariable(this->getScale3D().z, variableDirection::toclient); 104 105 registerVariable(this->parentID_, variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::updateParent)); 106 } 107 108 void WorldEntity::updateParent() 138 registerVariable(this->bActive_, variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedActivity)); 139 registerVariable(this->bVisible_, variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::changedVisibility)); 140 141 registerVariable(this->getScale3D(), variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::scaleChanged)); 142 143 registerVariable((int&)this->collisionTypeSynchronised_, 144 variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::collisionTypeChanged)); 145 registerVariable(this->mass_, variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::massChanged)); 146 registerVariable(this->restitution_, variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::restitutionChanged)); 147 registerVariable(this->angularFactor_, variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::angularFactorChanged)); 148 registerVariable(this->linearDamping_, variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::linearDampingChanged)); 149 registerVariable(this->angularDamping_, variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::angularDampingChanged)); 150 registerVariable(this->friction_, variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::frictionChanged)); 151 registerVariable(this->bPhysicsActiveSynchronised_, 152 variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::physicsActivityChanged)); 153 154 registerVariable(this->parentID_, variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::parentChanged)); 155 } 156 157 void WorldEntity::parentChanged() 109 158 { 110 159 if (this->parentID_ != OBJECTID_UNKNOWN) … … 116 165 } 117 166 167 void WorldEntity::collisionTypeChanged() 168 { 169 if (this->collisionTypeSynchronised_ != Dynamic && 170 this->collisionTypeSynchronised_ != Kinematic && 171 this->collisionTypeSynchronised_ != Static && 172 this->collisionTypeSynchronised_ != None) 173 { 174 CCOUT(1) << "Error when collsion Type was received over network. Unknown enum value:" << this->collisionTypeSynchronised_ << std::endl; 175 } 176 else if (this->collisionTypeSynchronised_ != collisionType_) 177 { 178 if (this->parent_) 179 CCOUT(2) << "Warning: Network connection tried to set the collision type of an attached WE. Ignoring." << std::endl; 180 else 181 this->setCollisionType(this->collisionTypeSynchronised_); 182 } 183 } 184 185 void WorldEntity::physicsActivityChanged() 186 { 187 if (this->bPhysicsActiveSynchronised_) 188 this->activatePhysics(); 189 else 190 this->deactivatePhysics(); 191 } 192 118 193 void WorldEntity::attach(WorldEntity* object) 119 194 { 195 // check first whether attaching is even allowed 196 if (object->hasPhysics()) 197 { 198 if (!this->hasPhysics()) 199 { 200 COUT(2) << "Warning: Cannot attach a physical object to a non physical one." << std::endl; 201 return; 202 } 203 else if (object->isDynamic()) 204 { 205 COUT(2) << "Warning: Cannot attach a dynamic object to a WorldEntity." << std::endl; 206 return; 207 } 208 else if (object->isKinematic() && this->isDynamic()) 209 { 210 COUT(2) << "Warning: Cannot attach a kinematic object to a dynamic one." << std::endl; 211 return; 212 } 213 else if (object->isKinematic()) 214 { 215 COUT(2) << "Warning: Cannot attach a kinematic object to a static or kinematic one: Not yet implemented." << std::endl; 216 return; 217 } 218 else 219 { 220 object->deactivatePhysics(); 221 } 222 } 223 120 224 if (object->getParent()) 121 225 object->detachFromParent(); … … 131 235 object->parent_ = this; 132 236 object->parentID_ = this->getObjectID(); 237 238 // collision shapes 239 this->attachCollisionShape(object->getCollisionShape()); 240 // mass 241 this->childrenMass_ += object->getMass(); 242 recalculateMassProps(); 133 243 } 134 244 135 245 void WorldEntity::detach(WorldEntity* object) 136 246 { 247 // collision shapes 248 this->detachCollisionShape(object->getCollisionShape()); 249 // mass 250 if (object->getMass() > 0.0f) 251 { 252 this->childrenMass_ -= object->getMass(); 253 recalculateMassProps(); 254 } 255 137 256 this->node_->removeChild(object->node_); 138 257 this->children_.erase(object); 139 258 object->parent_ = 0; 140 259 object->parentID_ = OBJECTID_UNKNOWN; 141 142 260 // this->getScene()->getRootSceneNode()->addChild(object->node_); 261 262 // Note: It is possible that the object has physics but was disabled when attaching 263 object->activatePhysics(); 143 264 } 144 265 … … 154 275 return 0; 155 276 } 277 278 void WorldEntity::attachOgreObject(Ogre::MovableObject* object) 279 { 280 this->node_->attachObject(object); 281 } 282 283 void WorldEntity::detachOgreObject(Ogre::MovableObject* object) 284 { 285 this->node_->detachObject(object); 286 } 287 288 Ogre::MovableObject* WorldEntity::detachOgreObject(const Ogre::String& name) 289 { 290 return this->node_->detachObject(name); 291 } 292 293 void WorldEntity::attachCollisionShape(CollisionShape* shape) 294 { 295 this->collisionShape_->addChildShape(shape); 296 // Note: this->collisionShape_ already notifies us of any changes. 297 } 298 299 void WorldEntity::detachCollisionShape(CollisionShape* shape) 300 { 301 this->collisionShape_->removeChildShape(shape); 302 // Note: this->collisionShape_ already notifies us of any changes. 303 } 304 305 CollisionShape* WorldEntity::getAttachedCollisionShape(unsigned int index) const 306 { 307 return this->collisionShape_->getChildShape(index); 308 } 309 310 void WorldEntity::activatePhysics() 311 { 312 if (this->isActive() && this->hasPhysics() && !this->isPhysicsActive() && !this->parent_) 313 { 314 this->getScene()->addPhysicalObject(this); 315 this->bPhysicsActive_ = true; 316 } 317 } 318 319 void WorldEntity::deactivatePhysics() 320 { 321 if (this->isPhysicsActive()) 322 { 323 this->getScene()->removePhysicalObject(this); 324 this->bPhysicsActive_ = false; 325 } 326 } 327 328 bool WorldEntity::addedToPhysicalWorld() const 329 { 330 return this->physicalBody_ && this->physicalBody_->isInWorld(); 331 } 332 333 #ifndef _NDEBUG 334 const Vector3& WorldEntity::getPosition() const 335 { 336 return this->node_->getPosition(); 337 } 338 339 const Quaternion& WorldEntity::getOrientation() const 340 { 341 return this->node_->getOrientation(); 342 } 343 344 const Vector3& WorldEntity::getScale3D() const 345 { 346 return this->node_->getScale(); 347 } 348 #endif 349 350 const Vector3& WorldEntity::getWorldPosition() const 351 { 352 return this->node_->_getDerivedPosition(); 353 } 354 355 const Quaternion& WorldEntity::getWorldOrientation() const 356 { 357 return this->node_->_getDerivedOrientation(); 358 } 359 360 void WorldEntity::translate(const Vector3& distance, TransformSpace::Space relativeTo) 361 { 362 switch (relativeTo) 363 { 364 case TransformSpace::Local: 365 // position is relative to parent so transform downwards 366 this->setPosition(this->getPosition() + this->getOrientation() * distance); 367 break; 368 case TransformSpace::Parent: 369 this->setPosition(this->getPosition() + distance); 370 break; 371 case TransformSpace::World: 372 // position is relative to parent so transform upwards 373 if (this->node_->getParent()) 374 setPosition(getPosition() + (node_->getParent()->_getDerivedOrientation().Inverse() * distance) 375 / node_->getParent()->_getDerivedScale()); 376 else 377 this->setPosition(this->getPosition() + distance); 378 break; 379 } 380 } 381 382 void WorldEntity::rotate(const Quaternion& rotation, TransformSpace::Space relativeTo) 383 { 384 switch(relativeTo) 385 { 386 case TransformSpace::Local: 387 this->setOrientation(this->getOrientation() * rotation); 388 break; 389 case TransformSpace::Parent: 390 // Rotations are normally relative to local axes, transform up 391 this->setOrientation(rotation * this->getOrientation()); 392 break; 393 case TransformSpace::World: 394 // Rotations are normally relative to local axes, transform up 395 this->setOrientation(this->getOrientation() * this->getWorldOrientation().Inverse() 396 * rotation * this->getWorldOrientation()); 397 break; 398 } 399 } 400 401 void WorldEntity::lookAt(const Vector3& target, TransformSpace::Space relativeTo, const Vector3& localDirectionVector) 402 { 403 Vector3 origin; 404 switch (relativeTo) 405 { 406 case TransformSpace::Local: 407 origin = Vector3::ZERO; 408 break; 409 case TransformSpace::Parent: 410 origin = this->getPosition(); 411 break; 412 case TransformSpace::World: 413 origin = this->getWorldPosition(); 414 break; 415 } 416 this->setDirection(target - origin, relativeTo, localDirectionVector); 417 } 418 419 void WorldEntity::setDirection(const Vector3& direction, TransformSpace::Space relativeTo, const Vector3& localDirectionVector) 420 { 421 Quaternion savedOrientation(this->getOrientation()); 422 Ogre::Node::TransformSpace ogreRelativeTo; 423 switch (relativeTo) 424 { 425 case TransformSpace::Local: 426 ogreRelativeTo = Ogre::Node::TS_LOCAL; break; 427 case TransformSpace::Parent: 428 ogreRelativeTo = Ogre::Node::TS_PARENT; break; 429 case TransformSpace::World: 430 ogreRelativeTo = Ogre::Node::TS_WORLD; break; 431 } 432 this->node_->setDirection(direction, ogreRelativeTo, localDirectionVector); 433 Quaternion newOrientation(this->node_->getOrientation()); 434 this->node_->setOrientation(savedOrientation); 435 this->setOrientation(newOrientation); 436 } 437 438 void WorldEntity::setScale3D(const Vector3& scale) 439 { 440 if (this->hasPhysics()) 441 { 442 CCOUT(2) << "Warning: Cannot set the scale of a physical object: Not yet implemented." << std::endl; 443 return; 444 } 445 446 this->node_->setScale(scale); 447 } 448 449 void WorldEntity::setCollisionType(CollisionType type) 450 { 451 // If we are already attached to a parent, this would be a bad idea.. 452 if (this->parent_) 453 { 454 CCOUT(2) << "Warning: Cannot set the collision type of a WorldEntity with a parent." << std::endl; 455 return; 456 } 457 else if (this->addedToPhysicalWorld()) 458 { 459 CCOUT(2) << "Warning: Cannot set the collision type at run time." << std::endl; 460 return; 461 } 462 463 // Check for type legality. Could be StaticEntity or MobileEntity 464 if (!this->isCollisionTypeLegal(type)) 465 return; 466 if (type != None && !this->getScene()->hasPhysics()) 467 { 468 CCOUT(2) << "Warning: Cannot have physical bodies in a non physical scene." << std::endl; 469 return; 470 } 471 472 // Check whether we have to create or destroy. 473 if (type != None && this->collisionType_ == None) 474 { 475 // Check whether there was some scaling applied. 476 if (!this->node_->getScale().positionEquals(Vector3(1, 1, 1), 0.001)) 477 { 478 CCOUT(2) << "Warning: Cannot create a physical body if there is scaling applied to the node: Not yet implemented." << std::endl; 479 return; 480 } 481 482 // Create new rigid body 483 btRigidBody::btRigidBodyConstructionInfo bodyConstructionInfo(0, this, this->collisionShape_->getCollisionShape()); 484 this->physicalBody_ = new btRigidBody(bodyConstructionInfo); 485 this->physicalBody_->setUserPointer(this); 486 this->physicalBody_->setActivationState(DISABLE_DEACTIVATION); 487 } 488 else if (type == None && this->collisionType_ != None) 489 { 490 // Destroy rigid body 491 assert(this->physicalBody_); 492 deactivatePhysics(); 493 delete this->physicalBody_; 494 this->physicalBody_ = 0; 495 this->collisionType_ = None; 496 this->collisionTypeSynchronised_ = None; 497 return; 498 } 499 500 // Change type 501 switch (type) 502 { 503 case Dynamic: 504 this->physicalBody_->setCollisionFlags(this->physicalBody_->getCollisionFlags() & !(btCollisionObject::CF_STATIC_OBJECT | btCollisionObject::CF_KINEMATIC_OBJECT)); 505 break; 506 case Kinematic: 507 this->physicalBody_->setCollisionFlags(this->physicalBody_->getCollisionFlags() & !btCollisionObject::CF_STATIC_OBJECT | btCollisionObject::CF_KINEMATIC_OBJECT); 508 break; 509 case Static: 510 this->physicalBody_->setCollisionFlags(this->physicalBody_->getCollisionFlags() & !btCollisionObject::CF_KINEMATIC_OBJECT | btCollisionObject::CF_STATIC_OBJECT); 511 break; 512 case None: 513 return; // this->collisionType_ was None too 514 } 515 516 // Only sets this->collisionShape_ 517 // However the assertion is to ensure that the internal bullet setting is right 518 updateCollisionType(); 519 assert(this->collisionType_ == type); 520 521 // update mass and inertia tensor 522 recalculateMassProps(); 523 resetPhysicsProps(); 524 activatePhysics(); 525 } 526 527 void WorldEntity::setCollisionTypeStr(const std::string& typeStr) 528 { 529 std::string typeStrLower = getLowercase(typeStr); 530 CollisionType type; 531 if (typeStrLower == "dynamic") 532 type = Dynamic; 533 else if (typeStrLower == "static") 534 type = Static; 535 else if (typeStrLower == "kinematic") 536 type = Kinematic; 537 else if (typeStrLower == "none") 538 type = None; 539 else 540 ThrowException(ParseError, std::string("Attempting to set an unknown collision type: '") + typeStr + "'."); 541 this->setCollisionType(type); 542 } 543 544 std::string WorldEntity::getCollisionTypeStr() const 545 { 546 switch (this->getCollisionType()) 547 { 548 case Dynamic: 549 return "dynamic"; 550 case Kinematic: 551 return "kinematic"; 552 case Static: 553 return "static"; 554 case None: 555 return "none"; 556 default: 557 assert(false); 558 return ""; 559 } 560 } 561 562 void WorldEntity::updateCollisionType() 563 { 564 if (!this->physicalBody_) 565 this->collisionType_ = None; 566 else if (this->physicalBody_->isKinematicObject()) 567 this->collisionType_ = Kinematic; 568 else if (this->physicalBody_->isStaticObject()) 569 this->collisionType_ = Static; 570 else 571 this->collisionType_ = Dynamic; 572 this->collisionTypeSynchronised_ = this->collisionType_; 573 } 574 575 void WorldEntity::notifyChildMassChanged() // Called by a child WE 576 { 577 // Note: CollisionShape changes of a child get handled over the internal CompoundCollisionShape already 578 // Recalculate mass 579 this->childrenMass_ = 0.0f; 580 for (std::set<WorldEntity*>::const_iterator it = this->children_.begin(); it != this->children_.end(); ++it) 581 this->childrenMass_ += (*it)->getMass(); 582 recalculateMassProps(); 583 // Notify parent WE 584 if (this->parent_) 585 parent_->notifyChildMassChanged(); 586 } 587 588 void WorldEntity::notifyCollisionShapeChanged() // called by this->collisionShape_ 589 { 590 if (hasPhysics()) 591 { 592 // Bullet doesn't like sudden changes of the collision shape, so we remove and add it again 593 if (this->addedToPhysicalWorld()) 594 { 595 this->deactivatePhysics(); 596 this->physicalBody_->setCollisionShape(this->collisionShape_->getCollisionShape()); 597 this->activatePhysics(); 598 } 599 else 600 this->physicalBody_->setCollisionShape(this->collisionShape_->getCollisionShape()); 601 } 602 recalculateMassProps(); 603 } 604 605 void WorldEntity::recalculateMassProps() 606 { 607 // Store local inertia for faster access. Evaluates to (0,0,0) if there is no collision shape. 608 float totalMass = this->mass_ + this->childrenMass_; 609 this->collisionShape_->calculateLocalInertia(totalMass, this->localInertia_); 610 if (this->hasPhysics()) 611 { 612 if (this->isStatic()) 613 { 614 // Just set everything to zero 615 this->physicalBody_->setMassProps(0.0f, btVector3(0, 0, 0)); 616 } 617 else if ((this->mass_ + this->childrenMass_) == 0.0f) 618 { 619 // Use default values to avoid very large or very small values 620 CCOUT(4) << "Warning: Setting the internal physical mass to 1.0 because mass_ is 0.0." << std::endl; 621 btVector3 inertia(0, 0, 0); 622 this->collisionShape_->calculateLocalInertia(1.0f, inertia); 623 this->physicalBody_->setMassProps(1.0f, inertia); 624 } 625 else 626 { 627 this->physicalBody_->setMassProps(totalMass, this->localInertia_); 628 } 629 } 630 } 631 632 void WorldEntity::resetPhysicsProps() 633 { 634 if (this->hasPhysics()) 635 { 636 this->physicalBody_->setRestitution(this->restitution_); 637 this->physicalBody_->setAngularFactor(this->angularFactor_); 638 this->physicalBody_->setDamping(this->linearDamping_, this->angularDamping_); 639 this->physicalBody_->setFriction(this->friction_); 640 } 641 } 156 642 } -
code/branches/presentation/src/orxonox/objects/worldentities/WorldEntity.h
r2371 r2459 22 22 * Author: 23 23 * Fabian 'x3n' Landau 24 * Reto Grieder (physics) 24 25 * Co-authors: 25 26 * ... … … 32 33 #include "OrxonoxPrereqs.h" 33 34 34 #define OGRE_FORCE_ANGLE_TYPES 35 35 #ifdef _NDEBUG 36 36 #include <OgreSceneNode.h> 37 #else 38 #include <OgrePrerequisites.h> 39 #endif 40 #include "LinearMath/btMotionState.h" 37 41 38 42 #include "network/synchronisable/Synchronisable.h" … … 42 46 namespace orxonox 43 47 { 44 class _OrxonoxExport WorldEntity : public BaseObject, public Synchronisable 48 class _OrxonoxExport WorldEntity : public BaseObject, public Synchronisable, public btMotionState 45 49 { 46 50 public: … … 51 55 void registerVariables(); 52 56 53 inline Ogre::SceneNode* getNode() const57 inline const Ogre::SceneNode* getNode() const 54 58 { return this->node_; } 55 59 … … 64 68 inline void setPosition(float x, float y, float z) 65 69 { this->setPosition(Vector3(x, y, z)); } 66 inline const Vector3& getPosition() const 67 { return this->node_->getPosition(); } 68 inline const Vector3& getWorldPosition() const 69 { return this->node_->getWorldPosition(); } 70 71 virtual void translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0; 72 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) 73 75 { this->translate(Vector3(x, y, z), relativeTo); } 74 76 … … 80 82 inline void setOrientation(const Vector3& axis, const Degree& angle) 81 83 { this->setOrientation(Quaternion(angle, axis)); } 82 inline const Quaternion& getOrientation() const 83 { return this->node_->getOrientation(); } 84 inline const Quaternion& getWorldOrientation() const 85 { return this->node_->getWorldOrientation(); } 86 87 virtual void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0; 88 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) 89 89 { this->rotate(Quaternion(angle, axis), relativeTo); } 90 inline void rotate(const Vector3& axis, const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) 91 { this->rotate(Quaternion(angle, axis), relativeTo); } 92 93 virtual void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0; 94 inline void yaw(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) 95 { this->yaw(Degree(angle), relativeTo); } 96 virtual void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0; 97 inline void pitch(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) 98 { this->pitch(Degree(angle), relativeTo); } 99 virtual void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) = 0; 100 inline void roll(const Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL) 101 { this->roll(Degree(angle), relativeTo); } 102 103 virtual void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z) = 0; 104 virtual void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z) = 0; 105 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) 106 101 { this->setDirection(Vector3(x, y, z), relativeTo, localDirectionVector); } 107 102 108 inline void setScale3D(const Vector3& scale) 109 { this->node_->setScale(scale); } 103 virtual void setScale3D(const Vector3& scale); 110 104 inline void setScale3D(float x, float y, float z) 111 { this->node_->setScale(x, y, z); } 112 inline const Vector3& getScale3D(void) const 113 { return this->node_->getScale(); } 114 115 inline void setScale(float scale) 116 { this->node_->setScale(scale, scale, scale); } 105 { this->setScale3D(Vector3(x, y, z)); } 106 const Vector3& getScale3D(void) const; 107 108 void setScale(float scale) 109 { this->setScale3D(scale, scale, scale); } 117 110 inline float getScale() const 118 111 { Vector3 scale = this->getScale3D(); return (scale.x == scale.y && scale.x == scale.z) ? scale.x : 1; } 119 112 120 113 inline void scale3D(const Vector3& scale) 121 { this-> node_->scale(scale); }114 { this->setScale3D(this->getScale3D() * scale); } 122 115 inline void scale3D(float x, float y, float z) 123 { this-> node_->scale(x, y, z); }116 { this->scale3D(Vector3(x, y, z)); } 124 117 inline void scale(float scale) 125 { this-> node_->scale(scale, scale, scale); }118 { this->scale3D(scale, scale, scale); } 126 119 127 120 void attach(WorldEntity* object); … … 130 123 inline const std::set<WorldEntity*>& getAttachedObjects() const 131 124 { return this->children_; } 125 126 void attachOgreObject(Ogre::MovableObject* object); 127 void detachOgreObject(Ogre::MovableObject* object); 128 Ogre::MovableObject* detachOgreObject(const Ogre::String& name); 132 129 133 130 inline void attachToParent(WorldEntity* parent) … … 138 135 { return this->parent_; } 139 136 137 void notifyChildPropsChanged(); 138 140 139 protected: 141 140 Ogre::SceneNode* node_; 142 141 143 142 private: 144 void updateParent();145 146 143 inline void lookAt_xmlport(const Vector3& target) 147 144 { this->lookAt(target); } … … 155 152 { this->roll(angle); } 156 153 154 // network callbacks 155 void parentChanged(); 156 inline void scaleChanged() 157 { this->setScale3D(this->getScale3D()); } 158 157 159 WorldEntity* parent_; 158 160 unsigned int parentID_; 159 161 std::set<WorldEntity*> children_; 162 163 164 ///////////// 165 // Physics // 166 ///////////// 167 168 public: 169 enum CollisionType 170 { 171 Dynamic, 172 Kinematic, 173 Static, 174 None 175 }; 176 177 bool hasPhysics() const { return getCollisionType() != None ; } 178 bool isStatic() const { return getCollisionType() == Static ; } 179 bool isKinematic() const { return getCollisionType() == Kinematic; } 180 bool isDynamic() const { return getCollisionType() == Dynamic ; } 181 bool isPhysicsActive() const { return this->bPhysicsActive_; } 182 bool addedToPhysicalWorld() const; 183 184 void activatePhysics(); 185 void deactivatePhysics(); 186 187 inline CollisionType getCollisionType() const 188 { return this->collisionType_; } 189 void setCollisionType(CollisionType type); 190 191 void setCollisionTypeStr(const std::string& type); 192 std::string getCollisionTypeStr() const; 193 194 inline void setMass(float mass) 195 { this->mass_ = mass; recalculateMassProps(); } 196 inline float getMass() const 197 { return this->mass_; } 198 199 inline float getTotalMass() const 200 { return this->mass_ + this->childrenMass_; } 201 202 inline const btVector3& getLocalInertia() const 203 { return this->localInertia_; } 204 205 inline void setRestitution(float restitution) 206 { this->restitution_ = restitution; resetPhysicsProps(); } 207 inline float getRestitution() const 208 { return this->restitution_; } 209 210 inline void setAngularFactor(float angularFactor) 211 { this->angularFactor_ = angularFactor; resetPhysicsProps(); } 212 inline float getAngularFactor() const 213 { return this->angularFactor_; } 214 215 inline void setLinearDamping(float linearDamping) 216 { this->linearDamping_ = linearDamping; resetPhysicsProps(); } 217 inline float getLinearDamping() const 218 { return this->linearDamping_; } 219 220 inline void setAngularDamping(float angularDamping) 221 { this->angularDamping_ = angularDamping; resetPhysicsProps(); } 222 inline float getAngularDamping() const 223 { return this->angularDamping_; } 224 225 inline void setFriction(float friction) 226 { this->friction_ = friction; resetPhysicsProps(); } 227 inline float getFriction() const 228 { return this->friction_; } 229 230 void attachCollisionShape(CollisionShape* shape); 231 void detachCollisionShape(CollisionShape* shape); 232 CollisionShape* getAttachedCollisionShape(unsigned int index) const; 233 234 inline CompoundCollisionShape* getCollisionShape() 235 { return this->collisionShape_; } 236 inline btRigidBody* getPhysicalBody() 237 { return this->physicalBody_; } 238 239 void notifyCollisionShapeChanged(); 240 void notifyChildMassChanged(); 241 242 protected: 243 virtual bool isCollisionTypeLegal(CollisionType type) const = 0; 244 245 btRigidBody* physicalBody_; 246 247 private: 248 void updateCollisionType(); 249 void recalculateMassProps(); 250 void resetPhysicsProps(); 251 252 // network callbacks 253 void collisionTypeChanged(); 254 void physicsActivityChanged(); 255 inline void massChanged() 256 { this->setMass(this->mass_); } 257 inline void restitutionChanged() 258 { this->setRestitution(this->restitution_); } 259 inline void angularFactorChanged() 260 { this->setAngularFactor(this->angularFactor_); } 261 inline void linearDampingChanged() 262 { this->setLinearDamping(this->linearDamping_); } 263 inline void angularDampingChanged() 264 { this->setAngularDamping(this->angularDamping_); } 265 inline void frictionChanged() 266 { this->setFriction(this->friction_); } 267 268 CollisionType collisionType_; 269 CollisionType collisionTypeSynchronised_; 270 bool bPhysicsActive_; 271 bool bPhysicsActiveSynchronised_; 272 CompoundCollisionShape* collisionShape_; 273 btScalar mass_; 274 btVector3 localInertia_; 275 btScalar restitution_; 276 btScalar angularFactor_; 277 btScalar linearDamping_; 278 btScalar angularDamping_; 279 btScalar friction_; 280 btScalar childrenMass_; 160 281 }; 282 283 // Inline heavily used functions for release builds. In debug, we better avoid including OgreSceneNode here. 284 #ifdef _NDEBUG 285 inline const Vector3& WorldEntity::getPosition() const 286 { return this->node_->getPosition(); } 287 inline const Quaternion& WorldEntity::getOrientation() const 288 { return this->node_->getrOrientation(); } 289 inline const Vector3& WorldEntity::getScale3D(void) const 290 { return this->node_->getScale(); } 291 #endif 161 292 } 162 293 -
code/branches/presentation/src/orxonox/objects/worldentities/pawns/SpaceShip.cc
r2371 r2459 30 30 #include "SpaceShip.h" 31 31 32 #include "BulletDynamics/Dynamics/btRigidBody.h" 33 34 #include "util/Math.h" 35 #include "util/Exception.h" 32 36 #include "core/CoreIncludes.h" 33 37 #include "core/ConfigValueIncludes.h" 34 38 #include "core/XMLPort.h" 35 #include "util/Math.h"36 39 37 40 namespace orxonox 38 41 { 42 const float orientationGain = 100; 39 43 CreateFactory(SpaceShip); 40 44 … … 43 47 RegisterObject(SpaceShip); 44 48 45 this->zeroDegree_ = 0; 49 this->primaryThrust_ = 100; 50 this->auxilaryThrust_ = 30; 51 this->rotationThrust_ = 10; 46 52 47 this->maxSpeed_ = 0; 48 this->maxSecondarySpeed_ = 0; 49 this->maxRotation_ = 0; 50 this->translationAcceleration_ = 0; 51 this->rotationAcceleration_ = 0; 52 this->translationDamping_ = 0; 53 54 this->yawRotation_ = 0; 55 this->pitchRotation_ = 0; 56 this->rollRotation_ = 0; 53 this->localLinearAcceleration_.setValue(0, 0, 0); 54 this->localAngularAcceleration_.setValue(0, 0, 0); 57 55 58 56 this->bInvertYAxis_ = false; 59 57 60 58 this->setDestroyWhenPlayerLeft(true); 59 60 // SpaceShip is always a physical object per default 61 // Be aware of this call: The collision type legality check will not reach derived classes! 62 this->setCollisionType(WorldEntity::Dynamic); 61 63 62 64 this->setConfigValues(); … … 72 74 SUPER(SpaceShip, XMLPort, xmlelement, mode); 73 75 74 XMLPortParam(SpaceShip, "maxspeed", setMaxSpeed, getMaxSpeed, xmlelement, mode); 75 XMLPortParam(SpaceShip, "maxsecondaryspeed", setMaxSecondarySpeed, getMaxSecondarySpeed, xmlelement, mode); 76 XMLPortParam(SpaceShip, "maxrotation", setMaxRotation, getMaxRotation, xmlelement, mode); 77 XMLPortParam(SpaceShip, "transacc", setTransAcc, getTransAcc, xmlelement, mode); 78 XMLPortParam(SpaceShip, "rotacc", setRotAcc, getRotAcc, xmlelement, mode); 79 XMLPortParam(SpaceShip, "transdamp", setTransDamp, getTransDamp, xmlelement, mode); 76 XMLPortParamVariable(SpaceShip, "primaryThrust", primaryThrust_, xmlelement, mode); 77 XMLPortParamVariable(SpaceShip, "auxilaryThrust", auxilaryThrust_, xmlelement, mode); 78 XMLPortParamVariable(SpaceShip, "rotationThrust", rotationThrust_, xmlelement, mode); 80 79 } 81 80 82 81 void SpaceShip::registerVariables() 83 82 { 84 registerVariable(this->maxSpeed_, variableDirection::toclient); 85 registerVariable(this->maxSecondarySpeed_, variableDirection::toclient); 86 registerVariable(this->maxRotation_, variableDirection::toclient); 87 registerVariable(this->translationAcceleration_, variableDirection::toclient); 88 registerVariable(this->rotationAcceleration_, variableDirection::toclient); 89 registerVariable(this->translationDamping_, variableDirection::toclient); 83 registerVariable(this->primaryThrust_, variableDirection::toclient); 84 registerVariable(this->auxilaryThrust_, variableDirection::toclient); 85 registerVariable(this->rotationThrust_, variableDirection::toclient); 90 86 } 91 87 … … 95 91 } 96 92 93 bool SpaceShip::isCollisionTypeLegal(WorldEntity::CollisionType type) const 94 { 95 if (type != WorldEntity::Dynamic) 96 { 97 CCOUT(1) << "Error: Cannot tell a SpaceShip not to be dynamic! Ignoring." << std::endl; 98 assert(false); // Only in debug mode 99 return false; 100 } 101 else 102 return true; 103 } 104 97 105 void SpaceShip::tick(float dt) 98 106 { 99 if (this->isLocallyControlled())100 {101 // #####################################102 // ############# STEERING ##############103 // #####################################104 105 Vector3 velocity = this->getVelocity();106 if (velocity.x > this->maxSecondarySpeed_)107 velocity.x = this->maxSecondarySpeed_;108 if (velocity.x < -this->maxSecondarySpeed_)109 velocity.x = -this->maxSecondarySpeed_;110 if (velocity.y > this->maxSecondarySpeed_)111 velocity.y = this->maxSecondarySpeed_;112 if (velocity.y < -this->maxSecondarySpeed_)113 velocity.y = -this->maxSecondarySpeed_;114 if (velocity.z > this->maxSecondarySpeed_)115 velocity.z = this->maxSecondarySpeed_;116 if (velocity.z < -this->maxSpeed_)117 velocity.z = -this->maxSpeed_;118 119 // normalize velocity and acceleration120 for (size_t dimension = 0; dimension < 3; ++dimension)121 {122 if (this->acceleration_[dimension] == 0)123 {124 if (velocity[dimension] > 0)125 {126 velocity[dimension] -= (this->translationDamping_ * dt);127 if (velocity[dimension] < 0)128 velocity[dimension] = 0;129 }130 else if (velocity[dimension] < 0)131 {132 velocity[dimension] += (this->translationDamping_ * dt);133 if (velocity[dimension] > 0)134 velocity[dimension] = 0;135 }136 }137 }138 139 this->setVelocity(velocity);140 }141 142 143 107 SUPER(SpaceShip, tick, dt); 144 145 108 146 109 if (this->isLocallyControlled()) 147 110 { 148 this->yaw(this->yawRotation_ * dt); 149 if (this->bInvertYAxis_) 150 this->pitch(Degree(-this->pitchRotation_ * dt)); 111 this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxilaryThrust_); 112 this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxilaryThrust_); 113 if (this->localLinearAcceleration_.z() > 0) 114 this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->auxilaryThrust_); 151 115 else 152 this->pitch(Degree( this->pitchRotation_ * dt)); 153 this->roll(this->rollRotation_ * dt); 116 this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->primaryThrust_); 117 this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * this->localLinearAcceleration_); 118 this->localLinearAcceleration_.setValue(0, 0, 0); 154 119 155 this->acceleration_.x = 0; 156 this->acceleration_.y = 0; 157 this->acceleration_.z = 0; 158 159 this->yawRotation_ = this->zeroDegree_; 160 this->pitchRotation_ = this->zeroDegree_; 161 this->rollRotation_ = this->zeroDegree_; 120 this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_; 121 this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_); 122 this->localAngularAcceleration_.setValue(0, 0, 0); 162 123 } 163 124 } … … 165 126 void SpaceShip::moveFrontBack(const Vector2& value) 166 127 { 167 this-> acceleration_.z = -this->translationAcceleration_ * value.x;128 this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x); 168 129 } 169 130 170 131 void SpaceShip::moveRightLeft(const Vector2& value) 171 132 { 172 this-> acceleration_.x = this->translationAcceleration_ * value.x;133 this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x); 173 134 } 174 135 175 136 void SpaceShip::moveUpDown(const Vector2& value) 176 137 { 177 this-> acceleration_.y = this->translationAcceleration_ * value.x;138 this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x); 178 139 } 179 140 180 141 void SpaceShip::rotateYaw(const Vector2& value) 181 142 { 182 Degree temp = value.x * value.x * sgn(value.x) * this->rotationAcceleration_; 183 if (temp > this->maxRotation_) 184 temp = this->maxRotation_; 185 if (temp < -this->maxRotation_) 186 temp = -this->maxRotation_; 187 this->yawRotation_ = Degree(temp); 143 this->localAngularAcceleration_.setY(this->localLinearAcceleration_.y() + value.x); 188 144 } 189 145 190 146 void SpaceShip::rotatePitch(const Vector2& value) 191 147 { 192 Degree temp = value.x * value.x * sgn(value.x) * this->rotationAcceleration_; 193 if (temp > this->maxRotation_) 194 temp = this->maxRotation_; 195 if (temp < -this->maxRotation_) 196 temp = -this->maxRotation_; 197 this->pitchRotation_ = Degree(temp); 148 this->localAngularAcceleration_.setX(this->localLinearAcceleration_.x() + value.x); 198 149 } 199 150 200 151 void SpaceShip::rotateRoll(const Vector2& value) 201 152 { 202 Degree temp = value.x * value.x * sgn(value.x) * this->rotationAcceleration_; 203 if (temp > this->maxRotation_) 204 temp = this->maxRotation_; 205 if (temp < -this->maxRotation_) 206 temp = -this->maxRotation_; 207 this->rollRotation_ = Degree(temp); 153 this->localAngularAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x); 208 154 } 209 155 -
code/branches/presentation/src/orxonox/objects/worldentities/pawns/SpaceShip.h
r2087 r2459 32 32 #include "OrxonoxPrereqs.h" 33 33 34 #include "LinearMath/btVector3.h" 35 34 36 #include "Pawn.h" 35 37 … … 57 59 virtual void fire(); 58 60 59 void setMaxSpeed(float value)60 { this->maxSpeed_ = value; }61 void setMaxSecondarySpeed(float value)62 { this->maxSecondarySpeed_ = value; }63 void setMaxRotation(const Degree& value)64 { this->maxRotation_ = value; }65 void setTransAcc(float value)66 { this->translationAcceleration_ = value; }67 void setRotAcc(const Degree& value)68 { this->rotationAcceleration_ = value; }69 void setTransDamp(float value)70 { this->translationDamping_ = value; }71 72 inline float getMaxSpeed() const73 { return this->maxSpeed_; }74 inline float getMaxSecondarySpeed() const75 { return this->maxSecondarySpeed_; }76 inline float getMaxRotation() const77 { return this->maxRotation_.valueDegrees(); }78 inline float getTransAcc() const79 { return this->translationAcceleration_; }80 inline float getRotAcc() const81 { return this->rotationAcceleration_.valueDegrees(); }82 inline float getTransDamp() const83 { return this->translationDamping_; }84 85 61 protected: 86 62 bool bInvertYAxis_; 87 63 88 float maxSpeed_; 89 float maxSecondarySpeed_; 90 float translationAcceleration_; 91 float translationDamping_; 64 float primaryThrust_; 65 float auxilaryThrust_; 66 float rotationThrust_; 92 67 93 Degree maxRotation_;94 Degree rotationAcceleration_;68 btVector3 localLinearAcceleration_; 69 btVector3 localAngularAcceleration_; 95 70 96 Degree zeroDegree_; 97 Degree pitchRotation_; 98 Degree yawRotation_; 99 Degree rollRotation_; 71 private: 72 virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const; 100 73 }; 101 74 } -
code/branches/presentation/src/orxonox/objects/worldentities/pawns/Spectator.cc
r2371 r2459 29 29 #include "OrxonoxStableHeaders.h" 30 30 #include "Spectator.h" 31 32 #include <OgreBillboardSet.h> 31 33 32 34 #include "core/CoreIncludes.h" … … 50 52 51 53 this->speed_ = 100; 52 this->rotation Speed_ = 3;54 this->rotationGain_ = 3; 53 55 54 56 this->yaw_ = 0; 55 57 this->pitch_ = 0; 56 58 this->roll_ = 0; 59 this->localVelocity_ = Vector3::ZERO; 57 60 this->setHudTemplate("spectatorhud"); 58 61 this->hudmode_ = 0; … … 63 66 this->greetingFlare_->setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(1.0, 1.0, 0.8), Vector3(0, 20, 0), 1); 64 67 if (this->greetingFlare_->getBillboardSet()) 65 this-> getNode()->attachObject(this->greetingFlare_->getBillboardSet());68 this->attachOgreObject(this->greetingFlare_->getBillboardSet()); 66 69 this->greetingFlare_->setVisible(false); 67 70 this->bGreetingFlareVisible_ = false; … … 78 81 { 79 82 if (this->greetingFlare_->getBillboardSet()) 80 this-> getNode()->detachObject(this->greetingFlare_->getBillboardSet());83 this->detachOgreObject(this->greetingFlare_->getBillboardSet()); 81 84 delete this->greetingFlare_; 82 85 } … … 108 111 if (this->isLocallyControlled()) 109 112 { 110 Vector3 velocity = this->getVelocity(); 111 velocity.normalise(); 112 this->setVelocity(velocity * this->speed_); 113 114 this->yaw(Radian(this->yaw_ * this->rotationSpeed_)); 115 this->pitch(Radian(this->pitch_ * this->rotationSpeed_)); 116 this->roll(Radian(this->roll_ * this->rotationSpeed_)); 113 float localSpeedSquared = this->localVelocity_.squaredLength(); 114 float localSpeed; 115 if (localSpeedSquared > 1.0) 116 localSpeed = this->speed_ / sqrtf(localSpeedSquared); 117 else 118 localSpeed = this->speed_; 119 120 this->localVelocity_.x *= localSpeed; 121 this->localVelocity_.y *= localSpeed; 122 this->localVelocity_.z *= localSpeed; 123 this->setVelocity(this->getOrientation() * this->localVelocity_); 124 this->localVelocity_.x = 0; 125 this->localVelocity_.y = 0; 126 this->localVelocity_.z = 0; 127 128 this->yaw (Radian(this->yaw_ * this->rotationGain_)); 129 this->pitch(Radian(this->pitch_ * this->rotationGain_)); 130 this->roll (Radian(this->roll_ * this->rotationGain_)); 117 131 118 132 this->yaw_ = this->pitch_ = this->roll_ = 0; … … 120 134 121 135 SUPER(Spectator, tick, dt); 122 123 if (this->isLocallyControlled())124 {125 this->setVelocity(Vector3::ZERO);126 }127 136 } 128 137 … … 143 152 void Spectator::moveFrontBack(const Vector2& value) 144 153 { 145 this-> setVelocity(this->getVelocity() + value.y * this->speed_ * WorldEntity::FRONT);154 this->localVelocity_.z -= value.x; 146 155 } 147 156 148 157 void Spectator::moveRightLeft(const Vector2& value) 149 158 { 150 this-> setVelocity(this->getVelocity() + value.y * this->speed_ * WorldEntity::RIGHT);159 this->localVelocity_.x += value.x; 151 160 } 152 161 153 162 void Spectator::moveUpDown(const Vector2& value) 154 163 { 155 this-> setVelocity(this->getVelocity() + value.y * this->speed_ * WorldEntity::UP);164 this->localVelocity_.y += value.x; 156 165 } 157 166 158 167 void Spectator::rotateYaw(const Vector2& value) 159 168 { 160 this->yaw_ = value.y;169 this->yaw_ += value.y; 161 170 } 162 171 163 172 void Spectator::rotatePitch(const Vector2& value) 164 173 { 165 this->pitch_ = value.y;174 this->pitch_ += value.y; 166 175 } 167 176 168 177 void Spectator::rotateRoll(const Vector2& value) 169 178 { 170 this->roll_ = value.y;179 this->roll_ += value.y; 171 180 } 172 181 -
code/branches/presentation/src/orxonox/objects/worldentities/pawns/Spectator.h
r2087 r2459 69 69 70 70 float speed_; 71 float rotation Speed_;71 float rotationGain_; 72 72 73 73 float yaw_; 74 74 float pitch_; 75 75 float roll_; 76 77 Vector3 localVelocity_; 76 78 77 79 int hudmode_; -
code/branches/presentation/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/objects/worldentities/triggers/Trigger.cc
- Property svn:mergeinfo changed
r2420 r2459 31 31 32 32 #include <OgreBillboard.h> 33 #include <OgreBillboardSet.h> 33 34 #include "util/Debug.h" 34 35 #include "core/CoreIncludes.h" … … 44 45 CreateFactory(Trigger); 45 46 46 Trigger::Trigger(BaseObject* creator) : PositionableEntity(creator)47 Trigger::Trigger(BaseObject* creator) : StaticEntity(creator) 47 48 { 48 49 RegisterObject(Trigger); … … 71 72 72 73 if (this->debugBillboard_.getBillboardSet()) 73 this->getNode()->attachObject(this->debugBillboard_.getBillboardSet());74 this->attachOgreObject(this->debugBillboard_.getBillboardSet()); 74 75 } 75 76 -
code/branches/presentation/src/orxonox/objects/worldentities/triggers/Trigger.h
- Property svn:mergeinfo changed
r2420 r2459 36 36 37 37 #include "objects/Tickable.h" 38 #include "objects/worldentities/ PositionableEntity.h"38 #include "objects/worldentities/StaticEntity.h" 39 39 #include "tools/BillboardSet.h" 40 40 … … 48 48 }; 49 49 50 class _OrxonoxExport Trigger : public PositionableEntity, public Tickable50 class _OrxonoxExport Trigger : public StaticEntity, public Tickable 51 51 { 52 52 public:
Note: See TracChangeset
for help on using the changeset viewer.