Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 1, 2008, 11:09:43 PM (15 years ago)
Author:
rgrieder
Message:
  • Added support for attaching physical WorldEntities to each other. Currently you can only add static objects to kinematic/dynamic/static other objects. Future plans involve attaching kinematic objects to static/kinematic ones. All other combinations don't make sense at all.
  • Added CollisionShape, SphereCollisionShape and CompoundCollisionShape

Usage for collision shapes (example):

<LinearEntity collisionType="kinematic">

<attached>

<Model position="0,0,0" scale=10 mesh="ast1.mesh" />
<StaticEntity position="0,10,0" collisionType="static"> # Everything else than "static" fails!

<collisionShapes>

<SphereCollisionShape radius=40 position="10,10,-10"/>
<CompoundCollisionShape position="4,4,4"> # You can also make compound shapes directly

<SphereCollisionShape radius=10/>

</CompoundCollisionShape>

</collisionShapes>

</StaticEntity>

</attached>

</LinearEntity>

File:
1 edited

Legend:

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

    r2300 r2303  
    3030#include "MovableEntity.h"
    3131
     32#include "BulletDynamics/Dynamics/btRigidBody.h"
     33
    3234#include "util/Exception.h"
    3335#include "core/CoreIncludes.h"
     
    6163    {
    6264    }
    63 
    64     //void MovableEntity::setPosition(const Vector3& position)
    65     //{
    66     //    //if (isDynamic() && bAddedToPhysicalWorld_)
    67     //    //{
    68     //    //    this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
    69     //    //    this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
    70     //    //}
    71     //    this->node_->setPosition(position);
    72     //    positionChanged();
    73     //}
    74 
    75     //void MovableEntity::translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo)
    76     //{
    77     //    //if (isDynamic() && bAddedToPhysicalWorld_)
    78     //    //{
    79     //    //    this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
    80     //    //    this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
    81     //    //}
    82     //    this->node_->translate(distance, relativeTo);
    83     //    positionChanged();
    84     //}
    85 
    86     //void MovableEntity::setOrientation(const Quaternion& orientation)
    87     //{
    88     //    //if (isDynamic() && bAddedToPhysicalWorld_)
    89     //    //{
    90     //    //    this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
    91     //    //    this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
    92     //    //}
    93     //    this->node_->setOrientation(orientation);
    94     //    orientationChanged();
    95     //}
    96 
    97     //void MovableEntity::rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo)
    98     //{
    99     //    //if (isDynamic() && bAddedToPhysicalWorld_)
    100     //    //{
    101     //    //    this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
    102     //    //    this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
    103     //    //}
    104     //    this->node_->rotate(rotation, relativeTo);
    105     //    orientationChanged();
    106     //}
    107 
    108     //void MovableEntity::yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
    109     //{
    110     //    //if (isDynamic() && bAddedToPhysicalWorld_)
    111     //    //{
    112     //    //    this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
    113     //    //    this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
    114     //    //}
    115     //    this->node_->yaw(angle, relativeTo);
    116     //    orientationChanged();
    117     //}
    118 
    119     //void MovableEntity::pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
    120     //{
    121     //    //if (isDynamic() && bAddedToPhysicalWorld_)
    122     //    //{
    123     //    //    this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
    124     //    //    this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
    125     //    //}
    126     //    this->node_->pitch(angle, relativeTo);
    127     //    orientationChanged();
    128     //}
    129 
    130     //void MovableEntity::roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo)
    131     //{
    132     //    //if (isDynamic() && bAddedToPhysicalWorld_)
    133     //    //{
    134     //    //    this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
    135     //    //    this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
    136     //    //}
    137     //    this->node_->roll(angle, relativeTo);
    138     //    orientationChanged();
    139     //}
    140 
    141     //void MovableEntity::lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)
    142     //{
    143     //    //if (isDynamic() && bAddedToPhysicalWorld_)
    144     //    //{
    145     //    //    this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
    146     //    //    this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
    147     //    //}
    148     //    this->node_->lookAt(target, relativeTo, localDirectionVector);
    149     //    orientationChanged();
    150     //}
    151 
    152     //void MovableEntity::setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo, const Vector3& localDirectionVector)
    153     //{
    154     //    //if (isDynamic() && bAddedToPhysicalWorld_)
    155     //    //{
    156     //    //    this->getScene()->getPhysicalWorld()->removeRigidBody(this->physicalBody_);
    157     //    //    this->getScene()->getPhysicalWorld()->addRigidBody(this->physicalBody_);
    158     //    //}
    159     //    this->node_->setDirection(direction, relativeTo, localDirectionVector);
    160     //    orientationChanged();
    161     //}
    16265
    16366    void MovableEntity::setPosition(const Vector3& position)
Note: See TracChangeset for help on using the changeset viewer.