Changeset 2851 for code/trunk/src/orxonox/objects/worldentities
- Timestamp:
- Mar 26, 2009, 11:59:39 AM (16 years ago)
- Location:
- code/trunk/src/orxonox/objects/worldentities
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/objects/worldentities/ControllableEntity.cc
r2839 r2851 335 335 } 336 336 337 void ControllableEntity::parentChanged() 338 { 339 WorldEntity::parentChanged(); 340 341 WorldEntity* parent = this->getParent(); 342 if (parent) 343 { 344 for (std::list<CameraPosition*>::iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it) 345 if ((*it)->getIsAbsolute()) 346 parent->attach((*it)); 347 } 348 } 349 337 350 void ControllableEntity::tick(float dt) 338 351 { -
code/trunk/src/orxonox/objects/worldentities/ControllableEntity.h
r2839 r2851 137 137 virtual void startLocalHumanControl(); 138 138 virtual void stopLocalHumanControl(); 139 virtual void parentChanged(); 139 140 140 141 inline void setHudTemplate(const std::string& name) -
code/trunk/src/orxonox/objects/worldentities/WorldEntity.cc
r2787 r2851 181 181 182 182 // Attach to parent if necessary 183 registerVariable(this->parentID_, variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity:: parentChanged));183 registerVariable(this->parentID_, variableDirection::toclient, new NetworkCallback<WorldEntity>(this, &WorldEntity::networkcallback_parentChanged)); 184 184 } 185 185 … … 188 188 Network function that object this instance to its correct parent. 189 189 */ 190 void WorldEntity:: parentChanged()190 void WorldEntity::networkcallback_parentChanged() 191 191 { 192 192 if (this->parentID_ != OBJECTID_UNKNOWN) … … 362 362 this->parentID_ = newParent->getObjectID(); 363 363 364 this->parentChanged(); 365 364 366 // apply transform to collision shape 365 367 this->collisionShape_->setPosition(this->getPosition()); 366 368 this->collisionShape_->setOrientation(this->getOrientation()); 367 369 // TODO: Scale 368 370 369 371 return true; 370 372 } … … 406 408 this->parent_ = 0; 407 409 this->parentID_ = OBJECTID_UNKNOWN; 410 411 this->parentChanged(); 408 412 409 413 // reset orientation of the collisionShape (cannot be set within a WE usually) -
code/trunk/src/orxonox/objects/worldentities/WorldEntity.h
r2787 r2851 176 176 177 177 protected: 178 virtual void parentChanged() {} 179 178 180 Ogre::SceneNode* node_; 179 181 … … 191 193 192 194 // network callbacks 193 void parentChanged();195 void networkcallback_parentChanged(); 194 196 inline void scaleChanged() 195 197 { this->setScale3D(this->getScale3D()); } … … 269 271 @brief 270 272 Sets how much reaction is applied in a collision. 271 273 272 274 Consider two equal spheres colliding with equal velocities: 273 275 Restitution 1 means that both spheres simply reverse their velocity (no loss of energy)
Note: See TracChangeset
for help on using the changeset viewer.