Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 30, 2008, 12:36:46 PM (16 years ago)
Author:
rgrieder
Message:

Still getting physics and its implications straight:

  • Removed PositionableEntity —> StaticEntity is now the way to go. They cannot be translated in any way during physics simulation. The trick will be to remove them and add them again to Bullet. This however is not yet implemented.
  • Forgot a few consts in WorldEntity
  • Fixed a bug with infinite masses
  • WE throws exception if you try to apply physics when the SceneNode is not in the root space of the Scene.
  • Moved velocity_ to MovableEntity
  • Outside world reference of WE/ME are now always the non-physical values. getPosition() will always return node_→getPosition() and when setting it, both RigidBody and SceneNode are translated. This accounts for velocity, orientation and position.
File:
1 edited

Legend:

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

    r2298 r2300  
    192192    }
    193193
    194     float WorldEntity::getMass()
     194    float WorldEntity::getMass() const
    195195    {
    196196        if (!checkPhysics())
    197197            return 0.0f;
    198198
    199         return 1.0f/this->physicalBody_->getInvMass();
     199        if (this->physicalBody_->getInvMass() == 0.0f)
     200            return 0.0f;
     201        else
     202            return 1.0f/this->physicalBody_->getInvMass();
    200203    }
    201204
     
    221224        if (type != None && this->collisionType_ == None)
    222225        {
     226            // First, check whether our SceneNode is relative to the root space of the scene.
     227            // TODO: Static and Kinematic objects don't always have to obey this rule.
     228            if (this->node_->getParent() != this->getScene()->getRootSceneNode())
     229                ThrowException(PhysicsViolation, "Cannot make WorldEntity physical that is not in the root space of the Scene.");
     230
    223231            // Create new rigid body
    224232            btRigidBody::btRigidBodyConstructionInfo bodyConstructionInfo(0, this, 0, btVector3(0,0,0));
     
    227235
    228236            // Adjust parameters according to the node
    229             btTransform nodeTransform;
     237            //btTransform nodeTransform;
    230238            //this->
    231239        }
     
    303311    }
    304312
    305     std::string WorldEntity::getCollisionTypeStr()
     313    std::string WorldEntity::getCollisionTypeStr() const
    306314    {
    307315        switch (this->getCollisionType())
     
    334342    }
    335343
    336     float WorldEntity::getCollisionRadius()
     344    float WorldEntity::getCollisionRadius() const
    337345    {
    338346        if (checkPhysics())
     
    345353    }
    346354
    347     bool WorldEntity::checkPhysics()
     355    bool WorldEntity::checkPhysics() const
    348356    {
    349357        if (!this->physicalBody_)
Note: See TracChangeset for help on using the changeset viewer.