- Timestamp:
- Dec 28, 2008, 7:42:30 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation/src/orxonox/objects/worldentities/WorldEntity.cc
r2535 r2540 52 52 const Vector3 WorldEntity::UP = Vector3::UNIT_Y; 53 53 54 /** 55 @brief 56 Creates a new WorldEntity that may immediately be used. 57 All the default values are being set here. 58 */ 54 59 WorldEntity::WorldEntity(BaseObject* creator) : BaseObject(creator), Synchronisable(creator), collisionShape_(0) 55 56 60 { 57 61 RegisterObject(WorldEntity); … … 92 96 } 93 97 98 /** 99 @brief 100 Destroys the WorldEntity AND ALL its children with it. 101 */ 94 102 WorldEntity::~WorldEntity() 95 103 { … … 172 180 } 173 181 182 /** 183 @brief 184 Network function that object this instance to its correct parent. 185 */ 174 186 void WorldEntity::parentChanged() 175 187 { … … 182 194 } 183 195 196 /** 197 @brief 198 Attaches this object to a parent SceneNode. 199 @Remarks 200 Only use this method if you know exactly what you're doing! 201 Normally, attaching works internally by attaching WE's. 202 */ 184 203 void WorldEntity::attachToNode(Ogre::SceneNode* node) 185 204 { … … 190 209 } 191 210 211 /** 212 @brief 213 Detaches this object from a parent SceneNode. 214 @Remarks 215 Only use this method if you know exactly what you're doing! 216 Normally, attaching works internally by attaching WE's. 217 */ 192 218 void WorldEntity::detachFromNode(Ogre::SceneNode* node) 193 219 { … … 196 222 } 197 223 224 /** 225 @brief 226 Network callback for the collision type. Only change the type if it was valid. 227 */ 198 228 void WorldEntity::collisionTypeChanged() 199 229 { … … 214 244 } 215 245 246 //! Network callback for this->bPhysicsActive_ 216 247 void WorldEntity::physicsActivityChanged() 217 248 { … … 222 253 } 223 254 255 //! Function is called to set the right flags in Bullet (if there is physics at all) 224 256 void WorldEntity::collisionCallbackActivityChanged() 225 257 { … … 235 267 } 236 268 269 /** 270 @brief 271 Attaches a child WorldEntity to this object. This calls notifyBeingAttached() 272 of the child WE. 273 @Note 274 The collision shape of the child object gets attached nevertheless. That also means 275 that you can change the collision shape of the child and it correctly cascadeds the changes to this instance. 276 Be aware of this implication: When implementing attaching of kinematic objects to others, you have to change 277 this behaviour because you then might not want to merge the collision shapes. 278 */ 237 279 void WorldEntity::attach(WorldEntity* object) 238 280 { … … 255 297 } 256 298 299 /** 300 @brief 301 Function gets called when this object is being attached to a new parent. 302 303 This operation is only allowed if the collision types "like" each other. 304 - You cannot a attach a non physical object to a physical one. 305 - Dynamic object can NOT be attached at all. 306 - It is also not possible to attach a kinematic to a dynamic one. 307 - Attaching of kinematic objects otherwise is not yet supported. 308 */ 257 309 bool WorldEntity::notifyBeingAttached(WorldEntity* newParent) 258 310 { … … 300 352 } 301 353 354 /** 355 @brief 356 Detaches a child WorldEntity from this instance. 357 */ 302 358 void WorldEntity::detach(WorldEntity* object) 303 359 { … … 324 380 } 325 381 382 /** 383 @brief 384 Function gets called when the object has been detached from its parent. 385 */ 326 386 void WorldEntity::notifyDetached() 327 387 { … … 341 401 } 342 402 403 //! Returns an attached object (merely for XMLPort). 343 404 WorldEntity* WorldEntity::getAttachedObject(unsigned int index) 344 405 { … … 353 414 } 354 415 416 //! Attaches an Ogre::SceneNode to this WorldEntity. 355 417 void WorldEntity::attachNode(Ogre::SceneNode* node) 356 418 { … … 361 423 } 362 424 425 //! Detaches an Ogre::SceneNode from this WorldEntity. 363 426 void WorldEntity::detachNode(Ogre::SceneNode* node) 364 427 { … … 367 430 } 368 431 432 //! Attaches an Ogre::MovableObject to this WorldEntity. 369 433 void WorldEntity::attachOgreObject(Ogre::MovableObject* object) 370 434 { … … 372 436 } 373 437 438 //! Detaches an Ogre::MovableObject from this WorldEntity. 374 439 void WorldEntity::detachOgreObject(Ogre::MovableObject* object) 375 440 { … … 377 442 } 378 443 444 //! Detaches an Ogre::MovableObject (by string) from this WorldEntity. 379 445 Ogre::MovableObject* WorldEntity::detachOgreObject(const Ogre::String& name) 380 446 { … … 382 448 } 383 449 450 //! Attaches a collision Shape to this object (delegated to the internal CompoundCollisionShape) 384 451 void WorldEntity::attachCollisionShape(CollisionShape* shape) 385 452 { … … 388 455 } 389 456 457 //! Detaches a collision Shape from this object (delegated to the internal CompoundCollisionShape) 390 458 void WorldEntity::detachCollisionShape(CollisionShape* shape) 391 459 { … … 394 462 } 395 463 396 CollisionShape* WorldEntity::getAttachedCollisionShape(unsigned int index) const 464 //! Returns an attached collision Shape of this object (delegated to the internal CompoundCollisionShape) 465 CollisionShape* WorldEntity::getAttachedCollisionShape(unsigned int index) 397 466 { 398 467 return this->collisionShape_.getAttachedShape(index); … … 417 486 #endif 418 487 488 //! Returns the position relative to the root space 419 489 const Vector3& WorldEntity::getWorldPosition() const 420 490 { … … 422 492 } 423 493 494 //! Returns the orientation relative to the root space 424 495 const Quaternion& WorldEntity::getWorldOrientation() const 425 496 { … … 427 498 } 428 499 500 //! Returns the scaling applied relative to the root space in 3 coordinates 429 501 const Vector3& WorldEntity::getWorldScale3D() const 430 502 { … … 432 504 } 433 505 506 /** 507 @brief 508 Returns the scaling applied relative to the root space in 3 coordinates 509 @return 510 Returns the scaling if it is uniform, 1.0f otherwise. 511 */ 434 512 float WorldEntity::getWorldScale() const 435 513 { … … 438 516 } 439 517 518 /** 519 @brief 520 Sets the three dimensional scaling of this object. 521 @Note 522 Scaling physical objects has not yet been implemented and is therefore forbidden. 523 */ 440 524 void WorldEntity::setScale3D(const Vector3& scale) 441 525 { … … 454 538 } 455 539 540 /** 541 @brief 542 Translates this WorldEntity by a vector. 543 @param relativeTo 544 @see TransformSpace::Enum 545 */ 456 546 void WorldEntity::translate(const Vector3& distance, TransformSpace::Enum relativeTo) 457 547 { … … 476 566 } 477 567 478 void WorldEntity::rotate(const Quaternion& rotation, TransformSpace::Space relativeTo) 568 /** 569 @brief 570 Rotates this WorldEntity by a quaternion. 571 @param relativeTo 572 @see TransformSpace::Enum 573 */ 479 574 void WorldEntity::rotate(const Quaternion& rotation, TransformSpace::Enum relativeTo) 480 575 { … … 496 591 } 497 592 498 void WorldEntity::lookAt(const Vector3& target, TransformSpace::Space relativeTo, const Vector3& localDirectionVector) 593 /** 594 @brief 595 Makes this WorldEntity look a specific target location. 596 @param relativeTo 597 @see TransformSpace::Enum 598 @param localDirectionVector 599 The vector which normally describes the natural direction of the object, usually -Z. 600 */ 499 601 void WorldEntity::lookAt(const Vector3& target, TransformSpace::Enum relativeTo, const Vector3& localDirectionVector) 500 602 { … … 515 617 } 516 618 517 void WorldEntity::setDirection(const Vector3& direction, TransformSpace::Space relativeTo, const Vector3& localDirectionVector) 619 /** 620 @brief 621 Makes this WorldEntity look in specific direction. 622 @param relativeTo 623 @see TransformSpace::Enum 624 @param localDirectionVector 625 The vector which normally describes the natural direction of the object, usually -Z. 626 */ 518 627 void WorldEntity::setDirection(const Vector3& direction, TransformSpace::Enum relativeTo, const Vector3& localDirectionVector) 519 628 { … … 535 644 } 536 645 646 //! Activates physics if the CollisionType is not None. 537 647 void WorldEntity::activatePhysics() 538 648 { … … 544 654 } 545 655 656 //! Deactivates physics but the CollisionType does not change. 546 657 void WorldEntity::deactivatePhysics() 547 658 { … … 553 664 } 554 665 666 //! Tells whether the object has already been added to the Bullet physics World. 555 667 bool WorldEntity::addedToPhysicalWorld() const 556 668 { … … 558 670 } 559 671 672 /** 673 @brief 674 Sets the CollisionType. This alters the object significantly! @see CollisionType. 675 @Note 676 Operation does not work on attached WorldEntities. 677 */ 560 678 void WorldEntity::setCollisionType(CollisionType type) 561 679 { … … 647 765 } 648 766 767 //! Sets the CollisionType by string (used for the XMLPort) 649 768 void WorldEntity::setCollisionTypeStr(const std::string& typeStr) 650 769 { … … 664 783 } 665 784 785 //! Gets the CollisionType by string (used for the XMLPort) 666 786 std::string WorldEntity::getCollisionTypeStr() const 667 787 { … … 695 815 } 696 816 817 /** 818 @brief 819 Recalculates the accumulated child mass and calls recalculateMassProps() 820 and notifies the parent of the change. 821 @Note 822 Called by a child WE 823 */ 697 824 void WorldEntity::notifyChildMassChanged() 698 825 { … … 708 835 } 709 836 837 /** 838 @brief 839 Undertakes the necessary steps to change the collision shape in Bullet, even at runtime. 840 @Note 841 - called by this->collisionShape_ 842 - May have a REALLY big overhead when called continuously at runtime, because then we need 843 to remove the physical body from Bullet and add it again. 844 */ 710 845 void WorldEntity::notifyCollisionShapeChanged() 711 846 { … … 725 860 } 726 861 862 //! Updates all mass dependent parameters (mass, inertia tensor and child mass) 727 863 void WorldEntity::recalculateMassProps() 728 864 { … … 740 876 { 741 877 // Use default values to avoid very large or very small values 742 CCOUT(4) << "Warning: Setting the internal physical mass to 1.0 because mass_ is 0.0 ." << std::endl;878 CCOUT(4) << "Warning: Setting the internal physical mass to 1.0 because mass_ is 0.0" << std::endl; 743 879 btVector3 inertia(0, 0, 0); 744 880 this->collisionShape_.calculateLocalInertia(1.0f, inertia); … … 752 888 } 753 889 890 //! Copies our own parameters for restitution, angular factor, dampings and friction to the bullet rigid body. 754 891 void WorldEntity::internalSetPhysicsProps() 755 892 {
Note: See TracChangeset
for help on using the changeset viewer.