- Timestamp:
- Dec 30, 2015, 10:07:09 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/orxonox/worldentities/WorldEntity.cc
r10916 r11004 56 56 57 57 // Be sure we don't do bad conversions 58 static_assert((int)Ogre::Node::TS_LOCAL == (int)WorldEntity:: Local, "check enum");59 static_assert((int)Ogre::Node::TS_PARENT == (int)WorldEntity:: Parent, "check enum");60 static_assert((int)Ogre::Node::TS_WORLD == (int)WorldEntity:: World, "check enum");58 static_assert((int)Ogre::Node::TS_LOCAL == (int)WorldEntity::TransformSpace::Local, "check enum"); 59 static_assert((int)Ogre::Node::TS_PARENT == (int)WorldEntity::TransformSpace::Parent, "check enum"); 60 static_assert((int)Ogre::Node::TS_WORLD == (int)WorldEntity::TransformSpace::World, "check enum"); 61 61 62 62 RegisterAbstractClass(WorldEntity).inheritsFrom<BaseObject>().inheritsFrom<Synchronisable>(); … … 95 95 this->collisionShape_ = new WorldEntityCollisionShape(this->getContext()); 96 96 this->collisionShape_->setWorldEntityOwner(this); 97 this->collisionType_ = None;98 this->collisionTypeSynchronised_ = None;97 this->collisionType_ = CollisionType::None; 98 this->collisionTypeSynchronised_ = CollisionType::None; 99 99 this->mass_ = 1.0f; 100 100 this->childrenMass_ = 0; … … 207 207 registerVariable(this->bCollisionResponseActive_, 208 208 VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::collisionResponseActivityChanged)); 209 registerVariable( (int&)this->collisionTypeSynchronised_,209 registerVariable(this->collisionTypeSynchronised_, 210 210 VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::collisionTypeChanged)); 211 211 registerVariable(this->bPhysicsActiveSynchronised_, … … 322 322 void WorldEntity::collisionTypeChanged() 323 323 { 324 if (this->collisionTypeSynchronised_ != Dynamic &&325 this->collisionTypeSynchronised_ != Kinematic &&326 this->collisionTypeSynchronised_ != Static &&327 this->collisionTypeSynchronised_ != None)324 if (this->collisionTypeSynchronised_ != CollisionType::Dynamic && 325 this->collisionTypeSynchronised_ != CollisionType::Kinematic && 326 this->collisionTypeSynchronised_ != CollisionType::Static && 327 this->collisionTypeSynchronised_ != CollisionType::None) 328 328 { 329 329 orxout(internal_error) << "Error when collsion Type was received over network. Unknown enum value:" << this->collisionTypeSynchronised_ << endl; … … 681 681 switch (relativeTo) 682 682 { 683 case WorldEntity::Local:683 case TransformSpace::Local: 684 684 // position is relative to parent so transform downwards 685 685 this->setPosition(this->getPosition() + this->getOrientation() * distance); 686 686 break; 687 case WorldEntity::Parent:687 case TransformSpace::Parent: 688 688 this->setPosition(this->getPosition() + distance); 689 689 break; 690 case WorldEntity::World:690 case TransformSpace::World: 691 691 // position is relative to parent so transform upwards 692 692 if (this->node_->getParent()) … … 711 711 switch(relativeTo) 712 712 { 713 case WorldEntity::Local:713 case TransformSpace::Local: 714 714 this->setOrientation(this->getOrientation() * rotation); 715 715 break; 716 case WorldEntity::Parent:716 case TransformSpace::Parent: 717 717 // Rotations are normally relative to local axes, transform up 718 718 this->setOrientation(rotation * this->getOrientation()); 719 719 break; 720 case WorldEntity::World:720 case TransformSpace::World: 721 721 // Rotations are normally relative to local axes, transform up 722 722 this->setOrientation(this->getOrientation() * this->getWorldOrientation().Inverse() … … 741 741 switch (relativeTo) 742 742 { 743 case WorldEntity::Local:743 case TransformSpace::Local: 744 744 origin = Vector3::ZERO; 745 745 break; 746 case WorldEntity::Parent:746 case TransformSpace::Parent: 747 747 origin = this->getPosition(); 748 748 break; 749 case WorldEntity::World:749 case TransformSpace::World: 750 750 origin = this->getWorldPosition(); 751 751 break; … … 831 831 832 832 // Check whether we have to create or destroy. 833 if (type != None && this->collisionType_ ==None)833 if (type != CollisionType::None && this->collisionType_ == CollisionType::None) 834 834 { 835 835 /* … … 849 849 this->physicalBody_->setActivationState(DISABLE_DEACTIVATION); 850 850 } 851 else if (type == None && this->collisionType_ !=None)851 else if (type == CollisionType::None && this->collisionType_ != CollisionType::None) 852 852 { 853 853 // Destroy rigid body … … 856 856 delete this->physicalBody_; 857 857 this->physicalBody_ = nullptr; 858 this->collisionType_ = None;859 this->collisionTypeSynchronised_ = None;858 this->collisionType_ = CollisionType::None; 859 this->collisionTypeSynchronised_ = CollisionType::None; 860 860 return; 861 861 } … … 864 864 switch (type) 865 865 { 866 case Dynamic:866 case CollisionType::Dynamic: 867 867 this->physicalBody_->setCollisionFlags(this->physicalBody_->getCollisionFlags() & !btCollisionObject::CF_STATIC_OBJECT & !btCollisionObject::CF_KINEMATIC_OBJECT); 868 868 break; 869 case Kinematic:869 case CollisionType::Kinematic: 870 870 this->physicalBody_->setCollisionFlags((this->physicalBody_->getCollisionFlags() & !btCollisionObject::CF_STATIC_OBJECT) | btCollisionObject::CF_KINEMATIC_OBJECT); 871 871 break; 872 case Static:872 case CollisionType::Static: 873 873 this->physicalBody_->setCollisionFlags((this->physicalBody_->getCollisionFlags() & !btCollisionObject::CF_KINEMATIC_OBJECT) | btCollisionObject::CF_STATIC_OBJECT); 874 874 break; 875 case None:875 case CollisionType::None: 876 876 assert(false); // Doesn't happen 877 877 return; … … 895 895 CollisionType type; 896 896 if (typeStrLower == "dynamic") 897 type = Dynamic;897 type = CollisionType::Dynamic; 898 898 else if (typeStrLower == "static") 899 type = Static;899 type = CollisionType::Static; 900 900 else if (typeStrLower == "kinematic") 901 type = Kinematic;901 type = CollisionType::Kinematic; 902 902 else if (typeStrLower == "none") 903 type = None;903 type = CollisionType::None; 904 904 else 905 905 ThrowException(ParseError, std::string("Attempting to set an unknown collision type: '") + typeStr + "'."); … … 912 912 switch (this->getCollisionType()) 913 913 { 914 case Dynamic:914 case CollisionType::Dynamic: 915 915 return "dynamic"; 916 case Kinematic:916 case CollisionType::Kinematic: 917 917 return "kinematic"; 918 case Static:918 case CollisionType::Static: 919 919 return "static"; 920 case None:920 case CollisionType::None: 921 921 return "none"; 922 922 default:
Note: See TracChangeset
for help on using the changeset viewer.