Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 28, 2008, 1:25:16 AM (17 years ago)
Author:
rgrieder
Message:

Finally managed to work out some physics. According to my tests, collisions with simple spheres should work with dynamic/kinematic/static objects. There are currently only a limited number of XML parameters, but we're surely going to extend that. Furthermore there is some more thinking to be done concerning changes of btRigidBody properties when it's already added to the world.

File:
1 edited

Legend:

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

    r2192 r2292  
    2929#include "OrxonoxStableHeaders.h"
    3030#include "StaticEntity.h"
     31
     32#include "util/Exception.h"
    3133#include "core/CoreIncludes.h"
    3234
     
    5759        REGISTERDATA(this->getOrientation().z, network::direction::toclient);
    5860    }
     61
     62    void StaticEntity::setCollisionType(CollisionType type)
     63    {
     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);
     70    }
     71
     72    void StaticEntity::setWorldTransform(const btTransform& worldTrans)
     73    {
     74        OrxAssert(false, "Setting world transform of a StaticEntity, which is static!");
     75        //COUT(0) << "Setting world transform of a StaticEntity, which is static!" << std::endl;
     76    }
     77
     78    void StaticEntity::getWorldTransform(btTransform& worldTrans) const
     79    {
     80        worldTrans.setOrigin(btVector3(node_->getPosition().x, node_->getPosition().y, node_->getPosition().z));
     81        worldTrans.setRotation(btQuaternion(node_->getOrientation().w, node_->getOrientation().x, node_->getOrientation().y, node_->getOrientation().z));
     82    }
    5983}
Note: See TracChangeset for help on using the changeset viewer.