Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 29, 2008, 12:45:19 AM (15 years ago)
Author:
rgrieder
Message:

Clarified use of different physical bodies. The "collisionType" XML attribute of WE specifies the following:
"none": There is not physical body at all. Physics disabled.
"static": It is a StaticEntity with physics. Any other derived class of WE issues an exception by choosing this collision type.
"kinematic" or "dynamic": MovableEntity with physics. StaticEntity issues an exception when choosing one of these two.

Added two new Exceptions: ParseError and PhysicsViolation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/physics/src/orxonox/objects/worldentities/StaticEntity.cc

    r2292 r2298  
    6060    }
    6161
    62     void StaticEntity::setCollisionType(CollisionType type)
     62    bool StaticEntity::isCollisionTypeLegal(WorldEntity::CollisionType type)
    6363    {
    64         if (!this->physicalBody_)
    65             return;
    66         if (type != Static)
    67             ThrowException(Argument, "Cannot tell a StaticEntity to be kinematic or dynamic");
    68 
    69         this->physicalBody_->setCollisionFlags(this->physicalBody_->getCollisionFlags() & !btCollisionObject::CF_KINEMATIC_OBJECT | btCollisionObject::CF_STATIC_OBJECT);
     64        if (type == WorldEntity::Static)
     65        {
     66            ThrowException(PhysicsViolation, "Cannot tell a MovableEntity to have static collision type");
     67            return false;
     68        }
     69        else
     70            return true;
    7071    }
    7172
Note: See TracChangeset for help on using the changeset viewer.