orxonox::WorldEntity Class Reference

The WorldEntity represents everything that can be put in a Scene at a certain location. More...

#include <src/orxonox/objects/worldentities/WorldEntity.h>

Inheritance diagram for orxonox::WorldEntity:

orxonox::BaseObject orxonox::Synchronisable orxonox::OrxonoxClass orxonox::OrxonoxClass orxonox::MobileEntity orxonox::StaticEntity orxonox::ControllableEntity orxonox::MovableEntity orxonox::Attacher orxonox::Billboard orxonox::Camera orxonox::CameraPosition orxonox::DroppedItem orxonox::ForceField orxonox::Light orxonox::Model orxonox::ParticleEmitter orxonox::PickupSpawner orxonox::PongCenterpoint orxonox::QuestEffectBeacon orxonox::SpawnPoint orxonox::Trigger orxonox::Weapon orxonox::WeaponSlot

List of all members.

Public Types

enum  CollisionType { Dynamic, Kinematic, Static, None }
 Denotes the possible types of physical objects in a Scene. More...
enum  TransformSpace { Local, Parent, World }
 Enumeration denoting the spaces which a transform can be relative to. More...

Public Member Functions

void activatePhysics ()
 Activates physics if the CollisionType is not None.
bool addedToPhysicalWorld () const
 Tells whether the object has already been added to the Bullet physics World.
void attach (WorldEntity *object)
 Attaches a child WorldEntity to this object. This calls notifyBeingAttached() of the child WE. The collision shape of the child object gets attached nevertheless. That also means that you can change the collision shape of the child and it correctly cascadeds the changes to this instance. Be aware of this implication: When implementing attaching of kinematic objects to others, you have to change this behaviour because you then might not want to merge the collision shapes.
void attachCollisionShape (CollisionShape *shape)
 Attaches a collision Shape to this object (delegated to the internal CompoundCollisionShape).
void attachNode (Ogre::SceneNode *node)
 Attaches an Ogre::SceneNode to this WorldEntity.
void attachOgreObject (Ogre::ParticleSystem *object)
void attachOgreObject (Ogre::Entity *object)
void attachOgreObject (Ogre::Camera *object)
void attachOgreObject (Ogre::BillboardSet *object)
void attachOgreObject (Ogre::MovableObject *object)
 Attaches an Ogre::MovableObject to this WorldEntity.
void attachToNode (Ogre::SceneNode *node)
 Attaches this object to a parent SceneNode. Only use this method if you know exactly what you're doing! Normally, attaching works internally by attaching WE's.
void attachToParent (WorldEntity *parent)
virtual void changedScale ()
virtual bool collidesAgainst (WorldEntity *otherObject, btManifoldPoint &contactPoint)
 Virtual function that gets called when this object collides with another.
void deactivatePhysics ()
 Deactivates physics but the CollisionType does not change.
void detach (WorldEntity *object)
 Detaches a child WorldEntity from this instance.
void detachCollisionShape (CollisionShape *shape)
 Detaches a collision Shape from this object (delegated to the internal CompoundCollisionShape).
void detachFromNode (Ogre::SceneNode *node)
 Detaches this object from a parent SceneNode. Only use this method if you know exactly what you're doing! Normally, attaching works internally by attaching WE's.
void detachFromParent ()
void detachNode (Ogre::SceneNode *node)
 Detaches an Ogre::SceneNode from this WorldEntity.
Ogre::MovableObject * detachOgreObject (const Ogre::String &name)
 Detaches an Ogre::MovableObject (by string) from this WorldEntity.
void detachOgreObject (Ogre::ParticleSystem *object)
void detachOgreObject (Ogre::Entity *object)
void detachOgreObject (Ogre::Camera *object)
void detachOgreObject (Ogre::BillboardSet *object)
void detachOgreObject (Ogre::MovableObject *object)
 Detaches an Ogre::MovableObject from this WorldEntity.
void disableCollisionCallback ()
 Disables the collidesAgainst(.) function.
void enableCollisionCallback ()
 Enables the collidesAgainst(.) function. The object doesn't respond to collision otherwise!
float getAngularDamping () const
 Returns the angular damping.
float getAngularFactor () const
 Returns the angular factor.
CollisionShapegetAttachedCollisionShape (unsigned int index)
 Returns an attached collision Shape of this object (delegated to the internal CompoundCollisionShape).
WorldEntitygetAttachedObject (unsigned int index)
 Returns an attached object (merely for XMLPort).
const std::set< WorldEntity * > & getAttachedObjects () const
CollisionType getCollisionType () const
 Returns the CollisionType.
std::string getCollisionTypeStr () const
 Gets the CollisionType by string (used for the XMLPort).
bool getDeleteWithParent () const
float getFriction () const
 Returns the amount of friction applied to the object.
float getLinearDamping () const
 Returns the linear damping.
const btVector3 & getLocalInertia () const
 Returns the diagonal elements of the inertia tensor when calculated in local coordinates. The local inertia tensor cannot be set, but is calculated by Bullet according to the collisionShape. With compound collision shapes, an approximation is used.
float getMass () const
 Returns the mass of this object without its children.
const Ogre::SceneNode * getNode () const
const Quaternion & getOrientation () const
WorldEntitygetParent () const
const Vector3 & getPosition () const
float getRestitution () const
 Returns the restitution parameter.
float getScale () const
const Vector3 & getScale3D () const
float getTotalMass () const
 Returns the total mass of this object with all its attached children.
virtual const Vector3 & getVelocity () const
const Quaternion & getWorldOrientation () const
 Returns the orientation relative to the root space.
const Vector3 & getWorldPosition () const
 Returns the position relative to the root space.
float getWorldScale () const
 Returns the scaling applied relative to the root space in 3 coordinates.
const Vector3 & getWorldScale3D () const
 Returns the scaling applied relative to the root space in 3 coordinates.
bool hasCollisionResponse ()
 Tells whether there could be a collision response.
bool hasPhysics () const
 Tells whether the object has any connection to the Bullet physics engine. If hasPhysics() is false, the object may still have a velocity.
bool isCollisionCallbackActive () const
 Tells whether there could be a collision callback via collidesAgainst(.).
bool isDynamic () const
bool isKinematic () const
bool isPhysicsActive () const
 Tells whether physics has been activated (you can temporarily deactivate it).
bool isStatic () const
void lookAt (const Vector3 &target, TransformSpace relativeTo=WorldEntity::Parent, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
 Makes this WorldEntity look a specific target location.
void notifyChildMassChanged ()
 Recalculates the accumulated child mass and calls recalculateMassProps() and notifies the parent of the change. Called by a child WE.
void notifyChildPropsChanged ()
void notifyCollisionShapeChanged ()
 Undertakes the necessary steps to change the collision shape in Bullet, even at runtime.
  • called by this->collisionShape_
  • May have a REALLY big overhead when called continuously at runtime, because then we need to remove the physical body from Bullet and add it again.

void pitch (const Degree &angle, TransformSpace relativeTo=WorldEntity::Local)
void registerVariables ()
void roll (const Degree &angle, TransformSpace relativeTo=WorldEntity::Local)
void rotate (const Vector3 &axis, const Degree &angle, TransformSpace relativeTo=WorldEntity::Local)
void rotate (const Quaternion &rotation, TransformSpace relativeTo=WorldEntity::Local)
 Rotates this WorldEntity by a quaternion.
void scale (float scale)
void scale3D (float x, float y, float z)
void scale3D (const Vector3 &scale)
void setAngularDamping (float angularDamping)
 Applies a tensor independent rotation damping. Angular velocities will simply diminish exponentially.
void setAngularFactor (float angularFactor)
 Sets an artificial parameter that tells how much torque is applied when you apply a non-central force.
void setCollisionResponse (bool value)
 Enables or disables collision response (default is of course on).
void setCollisionType (CollisionType type)
 Sets the CollisionType. This alters the object significantly!
void setCollisionTypeStr (const std::string &type)
 Sets the CollisionType by string (used for the XMLPort).
void setDeleteWithParent (bool value)
void setDirection (float x, float y, float z, TransformSpace relativeTo=WorldEntity::Local, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
void setDirection (const Vector3 &direction, TransformSpace relativeTo=WorldEntity::Local, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z)
 Makes this WorldEntity look in specific direction.
void setFriction (float friction)
 Applies friction to the object. Friction occurs when two objects collide.
void setLinearDamping (float linearDamping)
 Applies a mass independent damping. Velocities will simply diminish exponentially.
void setMass (float mass)
 Sets the mass of this object. Note that the total mass may be influenced by attached objects!
void setOrientation (const Vector3 &axis, const Degree &angle)
void setOrientation (const Vector3 &axis, const Radian &angle)
void setOrientation (float w, float x, float y, float z)
virtual void setOrientation (const Quaternion &orientation)=0
void setPosition (float x, float y, float z)
virtual void setPosition (const Vector3 &position)=0
void setRestitution (float restitution)
 Sets how much reaction is applied in a collision.
void setScale (float scale)
void setScale3D (float x, float y, float z)
virtual void setScale3D (const Vector3 &scale)
 Sets the three dimensional scaling of this object. Scaling physical objects has not yet been implemented and is therefore forbidden.
void translate (float x, float y, float z, TransformSpace relativeTo=WorldEntity::Parent)
void translate (const Vector3 &distance, TransformSpace relativeTo=WorldEntity::Parent)
 Translates this WorldEntity by a vector.
 WorldEntity (BaseObject *creator)
 Creates a new WorldEntity that may immediately be used. All the default values are being set here.
virtual void XMLPort (Element &xmlelement, XMLPort::Mode mode)
 XML loading and saving.
void yaw (const Degree &angle, TransformSpace relativeTo=WorldEntity::Local)
virtual ~WorldEntity ()
 Destroys the WorldEntity AND ALL its children with it.

Static Public Attributes

static const Vector3 BACK = Vector3::UNIT_Z
static const Vector3 DOWN = Vector3::NEGATIVE_UNIT_Y
static const Vector3 FRONT = Vector3::NEGATIVE_UNIT_Z
static const Vector3 LEFT = Vector3::NEGATIVE_UNIT_X
static const Vector3 RIGHT = Vector3::UNIT_X
static const Vector3 UP = Vector3::UNIT_Y

Protected Member Functions

virtual bool isCollisionTypeLegal (CollisionType type) const =0
 Function checks whether the requested collision type is legal to this object.
virtual void parentChanged ()

Protected Attributes

Ogre::SceneNode * node_
btRigidBody * physicalBody_
 Bullet rigid body. Everything physical is applied to this instance.

Private Member Functions

void angularDampingChanged ()
 Network callback workaround to call a function when the value changes.
void angularFactorChanged ()
 Network callback workaround to call a function when the value changes.
void collisionCallbackActivityChanged ()
 Function sets whether Bullet should issue a callback on collisions.
void collisionResponseActivityChanged ()
 Function sets whether Bullet should react itself to a collision.
void collisionTypeChanged ()
 Network callback for the collision type. Only change the type if it was valid.
void frictionChanged ()
 Network callback workaround to call a function when the value changes.
void internalSetPhysicsProps ()
 Copies our own parameters for restitution, angular factor, dampings and friction to the bullet rigid body.
void linearDampingChanged ()
 Network callback workaround to call a function when the value changes.
void lookAt_xmlport (const Vector3 &target)
void massChanged ()
 Network callback workaround to call a function when the value changes.
void networkcallback_parentChanged ()
 Network function that object this instance to its correct parent.
bool notifyBeingAttached (WorldEntity *newParent)
 Function gets called when this object is being attached to a new parent.
void notifyDetached ()
 Function gets called when the object has been detached from its parent.
void physicsActivityChanged ()
 Network callback for this->bPhysicsActive_.
void pitch_xmlport (const Degree &angle)
void recalculateMassProps ()
 Updates all mass dependent parameters (mass, inertia tensor and child mass).
void restitutionChanged ()
 Network callback workaround to call a function when the value changes.
void roll_xmlport (const Degree &angle)
void scaleChanged ()
void setDirection_xmlport (const Vector3 &direction)
void yaw_xmlport (const Degree &angle)

Private Attributes

btScalar angularDamping_
btScalar angularFactor_
bool bCollisionCallbackActive_
bool bCollisionResponseActive_
 Tells whether the object should respond to collisions.
bool bDeleteWithParent_
bool bPhysicsActive_
bool bPhysicsActiveBeforeAttaching_
 When attaching objects hierarchically this variable tells this object (as child) whether physics was activated before attaching (because the deactivate physics while being attached).
bool bPhysicsActiveSynchronised_
std::set< WorldEntity * > children_
btScalar childrenMass_
 Sum of all the children's masses.
WorldEntityCollisionShapecollisionShape_
 Attached collision shapes go here.
CollisionType collisionType_
CollisionType collisionTypeSynchronised_
 Network synchronised variable for collisionType_.
btScalar friction_
btScalar linearDamping_
btVector3 localInertia_
btScalar mass_
WorldEntityparent_
unsigned int parentID_
btScalar restitution_

Friends

class Scene


Detailed Description

The WorldEntity represents everything that can be put in a Scene at a certain location.

It is supposed to be the base class of everything you would call an 'object' in a Scene. The class itself is abstract which means you cannot use it directly. You may use StaticEntity as the simplest derivative or (derived from MobileEntity) MovableEntity and ControllableEntity as more advanced ones.

The basic task of the WorldEntity is provide a location, a direction and a scaling and the possibility to create an entire hierarchy of derivated objects. It is also the basis for the physics interface to the Bullet physics engine. Every WorldEntity can have a specific collision type:

See also:
CollisionType This would then imply that every scene object could have any collision type. To limit this, you can always override this->isCollisionTypeLegal(CollisionType). Return false if the collision type is not supported for a specific object. There is also support for attaching WorldEntities with physics to each other. Currently, the collision shape of both objects simply get merged into one larger shape (for static collision type). The phyiscal body that is internally stored and administrated has the following supported properties:
  • Restitution, angular factor, linear damping, angular damping, fricition, mass and collision shape. You can get more information at the corresponding set function.
Collision shapes: These are controlled by the internal WorldEntityCollisionShape.
See also:
WorldEntityCollisionShape.

Member Enumeration Documentation

Denotes the possible types of physical objects in a Scene.

Dynamic: The object is influenced by its physical environment, like for instance little ball. Kinematic: The object can only influence other dynamic objects. It's movement is coordinated by your own saying. Static: Like kinematic but the object is not allowed to move during the simulation. None: The object has no physics at all.

Enumerator:
Dynamic 
Kinematic 
Static 
None 

Enumeration denoting the spaces which a transform can be relative to.

Enumerator:
Local  Transform is relative to the local space.
Parent  Transform is relative to the space of the parent node.
World  Transform is relative to world space.


Constructor & Destructor Documentation

orxonox::WorldEntity::WorldEntity ( BaseObject creator  ) 

orxonox::WorldEntity::~WorldEntity (  )  [virtual]


Member Function Documentation

void orxonox::WorldEntity::activatePhysics (  ) 

bool orxonox::WorldEntity::addedToPhysicalWorld (  )  const

Tells whether the object has already been added to the Bullet physics World.

References physicalBody_.

Referenced by notifyCollisionShapeChanged(), orxonox::StaticEntity::setOrientation(), and orxonox::StaticEntity::setPosition().

void orxonox::WorldEntity::angularDampingChanged (  )  [inline, private]

Network callback workaround to call a function when the value changes.

Referenced by registerVariables().

void orxonox::WorldEntity::angularFactorChanged (  )  [inline, private]

Network callback workaround to call a function when the value changes.

Referenced by registerVariables().

void orxonox::WorldEntity::attach ( WorldEntity object  ) 

void orxonox::WorldEntity::attachCollisionShape ( CollisionShape shape  ) 

Attaches a collision Shape to this object (delegated to the internal CompoundCollisionShape).

References orxonox::CompoundCollisionShape::attach(), and collisionShape_.

Referenced by attach(), orxonox::CollisionShape::parentChanged(), orxonox::Projectile::Projectile(), and XMLPort().

void orxonox::WorldEntity::attachNode ( Ogre::SceneNode *  node  ) 

Attaches an Ogre::SceneNode to this WorldEntity.

References node_.

Referenced by attach(), orxonox::Camera::Camera(), and orxonox::Camera::setDrag().

void orxonox::WorldEntity::attachOgreObject ( Ogre::ParticleSystem *  object  ) 

References node_.

void orxonox::WorldEntity::attachOgreObject ( Ogre::Entity *  object  ) 

References node_.

void orxonox::WorldEntity::attachOgreObject ( Ogre::Camera *  object  ) 

References node_.

void orxonox::WorldEntity::attachOgreObject ( Ogre::BillboardSet *  object  ) 

References node_.

void orxonox::WorldEntity::attachOgreObject ( Ogre::MovableObject *  object  ) 

void orxonox::WorldEntity::attachToNode ( Ogre::SceneNode *  node  ) 

Attaches this object to a parent SceneNode. Only use this method if you know exactly what you're doing! Normally, attaching works internally by attaching WE's.

References node_.

Referenced by orxonox::ControllableEntity::addCameraPosition(), orxonox::ControllableEntity::startLocalHumanControl(), and orxonox::ControllableEntity::switchCamera().

void orxonox::WorldEntity::attachToParent ( WorldEntity parent  )  [inline]

virtual void orxonox::WorldEntity::changedScale (  )  [inline, virtual]

Reimplemented in orxonox::Backlight.

Referenced by setScale3D().

virtual bool orxonox::WorldEntity::collidesAgainst ( WorldEntity otherObject,
btManifoldPoint &  contactPoint 
) [inline, virtual]

Virtual function that gets called when this object collides with another.

Parameters:
otherObject The object this one has collided into. contactPoint Contact point provided by Bullet. Holds more information and can me modified. See return value. Returning false means that no modification to the contactPoint has been made. Return true otherwise! Condition is that enableCollisionCallback() was called.

Reimplemented in orxonox::Projectile, and orxonox::MovableEntity.

Referenced by orxonox::Scene::collisionCallback().

void orxonox::WorldEntity::collisionCallbackActivityChanged (  )  [private]

Function sets whether Bullet should issue a callback on collisions.

References bCollisionCallbackActive_, hasPhysics(), and physicalBody_.

Referenced by registerVariables(), and setCollisionType().

void orxonox::WorldEntity::collisionResponseActivityChanged (  )  [private]

Function sets whether Bullet should react itself to a collision.

References bCollisionResponseActive_, hasPhysics(), and physicalBody_.

Referenced by registerVariables(), and setCollisionType().

void orxonox::WorldEntity::collisionTypeChanged (  )  [private]

Network callback for the collision type. Only change the type if it was valid.

References CCOUT, collisionType_, collisionTypeSynchronised_, Dynamic, Kinematic, None, parent_, setCollisionType(), and Static.

Referenced by registerVariables().

void orxonox::WorldEntity::deactivatePhysics (  ) 

void orxonox::WorldEntity::detach ( WorldEntity object  ) 

void orxonox::WorldEntity::detachCollisionShape ( CollisionShape shape  ) 

Detaches a collision Shape from this object (delegated to the internal CompoundCollisionShape).

References collisionShape_, and orxonox::CompoundCollisionShape::detach().

Referenced by detach().

void orxonox::WorldEntity::detachFromNode ( Ogre::SceneNode *  node  ) 

Detaches this object from a parent SceneNode. Only use this method if you know exactly what you're doing! Normally, attaching works internally by attaching WE's.

References node_.

void orxonox::WorldEntity::detachFromParent (  )  [inline]

void orxonox::WorldEntity::detachNode ( Ogre::SceneNode *  node  ) 

Detaches an Ogre::SceneNode from this WorldEntity.

References node_.

Referenced by detach(), orxonox::Camera::setDrag(), and orxonox::Camera::~Camera().

Ogre::MovableObject * orxonox::WorldEntity::detachOgreObject ( const Ogre::String &  name  ) 

Detaches an Ogre::MovableObject (by string) from this WorldEntity.

References node_.

void orxonox::WorldEntity::detachOgreObject ( Ogre::ParticleSystem *  object  ) 

References node_.

void orxonox::WorldEntity::detachOgreObject ( Ogre::Entity *  object  ) 

References node_.

void orxonox::WorldEntity::detachOgreObject ( Ogre::Camera *  object  ) 

References node_.

void orxonox::WorldEntity::detachOgreObject ( Ogre::BillboardSet *  object  ) 

References node_.

void orxonox::WorldEntity::detachOgreObject ( Ogre::MovableObject *  object  ) 

void orxonox::WorldEntity::disableCollisionCallback (  )  [inline]

Disables the collidesAgainst(.) function.

See also:
enableCollisionCallback()

void orxonox::WorldEntity::enableCollisionCallback (  )  [inline]

Enables the collidesAgainst(.) function. The object doesn't respond to collision otherwise!

Referenced by orxonox::Projectile::Projectile(), and orxonox::SpaceShip::SpaceShip().

void orxonox::WorldEntity::frictionChanged (  )  [inline, private]

Network callback workaround to call a function when the value changes.

Referenced by registerVariables().

float orxonox::WorldEntity::getAngularDamping (  )  const [inline]

Returns the angular damping.

See also:
setAngularDamping.

Referenced by XMLPort().

float orxonox::WorldEntity::getAngularFactor (  )  const [inline]

Returns the angular factor.

See also:
setAngularFactor.

Referenced by XMLPort().

CollisionShape * orxonox::WorldEntity::getAttachedCollisionShape ( unsigned int  index  ) 

Returns an attached collision Shape of this object (delegated to the internal CompoundCollisionShape).

References collisionShape_, and orxonox::CompoundCollisionShape::getAttachedShape().

Referenced by XMLPort().

WorldEntity * orxonox::WorldEntity::getAttachedObject ( unsigned int  index  ) 

Returns an attached object (merely for XMLPort).

References children_.

Referenced by XMLPort().

const std::set<WorldEntity*>& orxonox::WorldEntity::getAttachedObjects (  )  const [inline]

CollisionType orxonox::WorldEntity::getCollisionType (  )  const [inline]

Returns the CollisionType.

See also:
CollisionType.

Referenced by getCollisionTypeStr().

std::string orxonox::WorldEntity::getCollisionTypeStr (  )  const

Gets the CollisionType by string (used for the XMLPort).

References Dynamic, getCollisionType(), Kinematic, None, and Static.

Referenced by XMLPort().

bool orxonox::WorldEntity::getDeleteWithParent (  )  const [inline]

Referenced by XMLPort().

float orxonox::WorldEntity::getFriction (  )  const [inline]

Returns the amount of friction applied to the object.

Referenced by XMLPort().

float orxonox::WorldEntity::getLinearDamping (  )  const [inline]

Returns the linear damping.

See also:
setLinearDamping.

Referenced by XMLPort().

const btVector3& orxonox::WorldEntity::getLocalInertia (  )  const [inline]

Returns the diagonal elements of the inertia tensor when calculated in local coordinates. The local inertia tensor cannot be set, but is calculated by Bullet according to the collisionShape. With compound collision shapes, an approximation is used.

Referenced by orxonox::SpaceShip::tick().

float orxonox::WorldEntity::getMass (  )  const [inline]

Returns the mass of this object without its children.

Referenced by orxonox::MobileEntity::applyCentralForce(), detach(), orxonox::MobileEntity::setAcceleration(), and XMLPort().

const Ogre::SceneNode* orxonox::WorldEntity::getNode (  )  const [inline]

const Quaternion & orxonox::WorldEntity::getOrientation (  )  const

WorldEntity* orxonox::WorldEntity::getParent (  )  const [inline]

const Vector3 & orxonox::WorldEntity::getPosition (  )  const

float orxonox::WorldEntity::getRestitution (  )  const [inline]

Returns the restitution parameter.

See also:
setRestitution.

Referenced by XMLPort().

float orxonox::WorldEntity::getScale (  )  const [inline]

const Vector3 & orxonox::WorldEntity::getScale3D (  )  const

References node_.

Referenced by registerVariables(), and XMLPort().

float orxonox::WorldEntity::getTotalMass (  )  const [inline]

Returns the total mass of this object with all its attached children.

virtual const Vector3& orxonox::WorldEntity::getVelocity (  )  const [inline, virtual]

Reimplemented in orxonox::MobileEntity.

Referenced by orxonox::SoundBase::update().

const Quaternion & orxonox::WorldEntity::getWorldOrientation (  )  const

const Vector3 & orxonox::WorldEntity::getWorldPosition (  )  const

float orxonox::WorldEntity::getWorldScale (  )  const

Returns the scaling applied relative to the root space in 3 coordinates.

Returns:
Returns the scaling if it is uniform, 1.0f otherwise.

References getWorldScale3D(), scale(), and orxonox::MT_Type::Vector3.

Referenced by orxonox::Backlight::update_length(), orxonox::Backlight::update_lifetime(), and orxonox::Backlight::update_width().

const Vector3 & orxonox::WorldEntity::getWorldScale3D (  )  const

Returns the scaling applied relative to the root space in 3 coordinates.

References node_.

Referenced by getWorldScale().

bool orxonox::WorldEntity::hasCollisionResponse (  )  [inline]

Tells whether there could be a collision response.

Referenced by XMLPort().

bool orxonox::WorldEntity::hasPhysics (  )  const [inline]

Tells whether the object has any connection to the Bullet physics engine. If hasPhysics() is false, the object may still have a velocity.

References orxonox::KeybindMode::None.

Referenced by activatePhysics(), collisionCallbackActivityChanged(), collisionResponseActivityChanged(), internalSetPhysicsProps(), notifyBeingAttached(), notifyCollisionShapeChanged(), recalculateMassProps(), and setCollisionType().

void orxonox::WorldEntity::internalSetPhysicsProps (  )  [private]

Copies our own parameters for restitution, angular factor, dampings and friction to the bullet rigid body.

References angularDamping_, angularFactor_, friction_, hasPhysics(), linearDamping_, physicalBody_, and restitution_.

Referenced by setCollisionType().

bool orxonox::WorldEntity::isCollisionCallbackActive (  )  const [inline]

Tells whether there could be a collision callback via collidesAgainst(.).

Referenced by orxonox::Scene::collisionCallback().

virtual bool orxonox::WorldEntity::isCollisionTypeLegal ( CollisionType  type  )  const [protected, pure virtual]

Function checks whether the requested collision type is legal to this object.

You can override this function in a derived class to constrain the collision to e.g. None or Dynamic. A projectile may not prove very useful if there is no physical body. Simply set the CollisionType in its constructor and override this method. But be careful that a derived classe's virtual functions don't yet exist in the constructor if a base class.

Implemented in orxonox::MobileEntity, orxonox::SpaceShip, and orxonox::StaticEntity.

Referenced by setCollisionType().

bool orxonox::WorldEntity::isDynamic (  )  const [inline]

bool orxonox::WorldEntity::isKinematic (  )  const [inline]

See also:
CollisionType

Referenced by notifyBeingAttached().

bool orxonox::WorldEntity::isPhysicsActive (  )  const [inline]

Tells whether physics has been activated (you can temporarily deactivate it).

Referenced by activatePhysics(), deactivatePhysics(), notifyBeingAttached(), and setCollisionType().

bool orxonox::WorldEntity::isStatic (  )  const [inline]

void orxonox::WorldEntity::linearDampingChanged (  )  [inline, private]

Network callback workaround to call a function when the value changes.

Referenced by registerVariables().

void orxonox::WorldEntity::lookAt ( const Vector3 &  target,
TransformSpace  relativeTo = WorldEntity::Parent,
const Vector3 &  localDirectionVector = Vector3::NEGATIVE_UNIT_Z 
)

Makes this WorldEntity look a specific target location.

Parameters:
relativeTo 
See also:
WorldEntity::TransformSpace
Parameters:
localDirectionVector The vector which normally describes the natural direction of the object, usually -Z.

References getPosition(), getWorldPosition(), Local, Parent, setDirection(), orxonox::MT_Type::Vector3, and World.

void orxonox::WorldEntity::lookAt_xmlport ( const Vector3 &  target  )  [inline, private]

Referenced by XMLPort().

void orxonox::WorldEntity::massChanged (  )  [inline, private]

Network callback workaround to call a function when the value changes.

Referenced by registerVariables().

void orxonox::WorldEntity::networkcallback_parentChanged (  )  [private]

Network function that object this instance to its correct parent.

References attachToParent(), orxonox::Synchronisable::getSynchronisable(), orxonox::OBJECTID_UNKNOWN, and parentID_.

Referenced by registerVariables().

bool orxonox::WorldEntity::notifyBeingAttached ( WorldEntity newParent  )  [private]

Function gets called when this object is being attached to a new parent.

This operation is only allowed if the collision types "like" each other.

  • You cannot a attach a non physical object to a physical one.
  • Dynamic object can NOT be attached at all.
  • It is also not possible to attach a kinematic to a dynamic one.
  • Attaching of kinematic objects otherwise is not yet supported.

References bPhysicsActiveBeforeAttaching_, collisionShape_, COUT, deactivatePhysics(), detachFromParent(), orxonox::Synchronisable::getObjectID(), getOrientation(), getPosition(), hasPhysics(), isDynamic(), isKinematic(), isPhysicsActive(), parent_, parentChanged(), parentID_, orxonox::CollisionShape::setOrientation(), and orxonox::CollisionShape::setPosition().

Referenced by attach().

void orxonox::WorldEntity::notifyChildMassChanged (  ) 

Recalculates the accumulated child mass and calls recalculateMassProps() and notifies the parent of the change. Called by a child WE.

References children_, childrenMass_, notifyChildMassChanged(), parent_, and recalculateMassProps().

Referenced by notifyChildMassChanged().

void orxonox::WorldEntity::notifyChildPropsChanged (  ) 

void orxonox::WorldEntity::notifyCollisionShapeChanged (  ) 

Undertakes the necessary steps to change the collision shape in Bullet, even at runtime.

  • called by this->collisionShape_
  • May have a REALLY big overhead when called continuously at runtime, because then we need to remove the physical body from Bullet and add it again.

References activatePhysics(), addedToPhysicalWorld(), collisionShape_, deactivatePhysics(), orxonox::CollisionShape::getCollisionShape(), hasPhysics(), physicalBody_, and recalculateMassProps().

Referenced by orxonox::WorldEntityCollisionShape::updateParent().

void orxonox::WorldEntity::notifyDetached (  )  [private]

virtual void orxonox::WorldEntity::parentChanged (  )  [inline, protected, virtual]

void orxonox::WorldEntity::physicsActivityChanged (  )  [private]

Network callback for this->bPhysicsActive_.

References activatePhysics(), bPhysicsActiveSynchronised_, and deactivatePhysics().

Referenced by registerVariables().

void orxonox::WorldEntity::pitch ( const Degree &  angle,
TransformSpace  relativeTo = WorldEntity::Local 
) [inline]

void orxonox::WorldEntity::pitch_xmlport ( const Degree &  angle  )  [inline, private]

Referenced by XMLPort().

void orxonox::WorldEntity::recalculateMassProps (  )  [private]

void orxonox::WorldEntity::registerVariables (  ) 

void orxonox::WorldEntity::restitutionChanged (  )  [inline, private]

Network callback workaround to call a function when the value changes.

Referenced by registerVariables().

void orxonox::WorldEntity::roll ( const Degree &  angle,
TransformSpace  relativeTo = WorldEntity::Local 
) [inline]

void orxonox::WorldEntity::roll_xmlport ( const Degree &  angle  )  [inline, private]

Referenced by XMLPort().

void orxonox::WorldEntity::rotate ( const Vector3 &  axis,
const Degree &  angle,
TransformSpace  relativeTo = WorldEntity::Local 
) [inline]

void orxonox::WorldEntity::rotate ( const Quaternion &  rotation,
TransformSpace  relativeTo = WorldEntity::Local 
)

Rotates this WorldEntity by a quaternion.

Parameters:
relativeTo 
See also:
WorldEntity::TransformSpace

References getOrientation(), getWorldOrientation(), Local, Parent, setOrientation(), and World.

void orxonox::WorldEntity::scale ( float  scale  )  [inline]

void orxonox::WorldEntity::scale3D ( float  x,
float  y,
float  z 
) [inline]

void orxonox::WorldEntity::scale3D ( const Vector3 &  scale  )  [inline]

void orxonox::WorldEntity::scaleChanged (  )  [inline, private]

Referenced by registerVariables().

void orxonox::WorldEntity::setAngularDamping ( float  angularDamping  )  [inline]

Applies a tensor independent rotation damping. Angular velocities will simply diminish exponentially.

Referenced by XMLPort().

void orxonox::WorldEntity::setAngularFactor ( float  angularFactor  )  [inline]

Sets an artificial parameter that tells how much torque is applied when you apply a non-central force.

Normally the angular factor is 1, which means it's physically 'correct'. Howerver if you have a player character that should not rotate when hit sideways, you can set the angular factor to 0.

Referenced by XMLPort().

void orxonox::WorldEntity::setCollisionResponse ( bool  value  )  [inline]

Enables or disables collision response (default is of course on).

Referenced by orxonox::Projectile::Projectile(), and XMLPort().

void orxonox::WorldEntity::setCollisionType ( CollisionType  type  ) 

void orxonox::WorldEntity::setCollisionTypeStr ( const std::string type  ) 

Sets the CollisionType by string (used for the XMLPort).

References Dynamic, orxonox::getLowercase(), Kinematic, None, setCollisionType(), Static, and ThrowException.

Referenced by XMLPort().

void orxonox::WorldEntity::setDeleteWithParent ( bool  value  )  [inline]

Referenced by XMLPort().

void orxonox::WorldEntity::setDirection ( float  x,
float  y,
float  z,
TransformSpace  relativeTo = WorldEntity::Local,
const Vector3 &  localDirectionVector = Vector3::NEGATIVE_UNIT_Z 
) [inline]

void orxonox::WorldEntity::setDirection ( const Vector3 &  direction,
TransformSpace  relativeTo = WorldEntity::Local,
const Vector3 &  localDirectionVector = Vector3::NEGATIVE_UNIT_Z 
)

Makes this WorldEntity look in specific direction.

Parameters:
relativeTo 
See also:
WorldEntity::TransformSpace
Parameters:
localDirectionVector The vector which normally describes the natural direction of the object, usually -Z.

References getOrientation(), node_, orxonox::MT_Type::Quaternion, and setOrientation().

Referenced by orxonox::ForceField::ForceField(), and lookAt().

void orxonox::WorldEntity::setDirection_xmlport ( const Vector3 &  direction  )  [inline, private]

Referenced by XMLPort().

void orxonox::WorldEntity::setFriction ( float  friction  )  [inline]

Applies friction to the object. Friction occurs when two objects collide.

Referenced by XMLPort().

void orxonox::WorldEntity::setLinearDamping ( float  linearDamping  )  [inline]

Applies a mass independent damping. Velocities will simply diminish exponentially.

Referenced by XMLPort().

void orxonox::WorldEntity::setMass ( float  mass  )  [inline]

Sets the mass of this object. Note that the total mass may be influenced by attached objects!

Referenced by XMLPort().

void orxonox::WorldEntity::setOrientation ( const Vector3 &  axis,
const Degree &  angle 
) [inline]

void orxonox::WorldEntity::setOrientation ( const Vector3 &  axis,
const Radian &  angle 
) [inline]

void orxonox::WorldEntity::setOrientation ( float  w,
float  x,
float  y,
float  z 
) [inline]

virtual void orxonox::WorldEntity::setOrientation ( const Quaternion &  orientation  )  [pure virtual]

void orxonox::WorldEntity::setPosition ( float  x,
float  y,
float  z 
) [inline]

virtual void orxonox::WorldEntity::setPosition ( const Vector3 &  position  )  [pure virtual]

void orxonox::WorldEntity::setRestitution ( float  restitution  )  [inline]

Sets how much reaction is applied in a collision.

Consider two equal spheres colliding with equal velocities: Restitution 1 means that both spheres simply reverse their velocity (no loss of energy) Restitution 0 means that both spheres will immediately stop moving (maximum loss of energy without violating of the preservation of momentum)

Referenced by XMLPort().

void orxonox::WorldEntity::setScale ( float  scale  )  [inline]

void orxonox::WorldEntity::setScale3D ( float  x,
float  y,
float  z 
) [inline]

void orxonox::WorldEntity::setScale3D ( const Vector3 &  scale  )  [virtual]

Sets the three dimensional scaling of this object. Scaling physical objects has not yet been implemented and is therefore forbidden.

References changedScale(), and node_.

Referenced by XMLPort().

void orxonox::WorldEntity::translate ( float  x,
float  y,
float  z,
TransformSpace  relativeTo = WorldEntity::Parent 
) [inline]

void orxonox::WorldEntity::translate ( const Vector3 &  distance,
TransformSpace  relativeTo = WorldEntity::Parent 
)

Translates this WorldEntity by a vector.

Parameters:
relativeTo 
See also:
WorldEntity::TransformSpace

References getOrientation(), getPosition(), Local, node_, Parent, setPosition(), and World.

Referenced by orxonox::PickupSpawner::tick().

void orxonox::WorldEntity::XMLPort ( Element &  xmlelement,
XMLPort::Mode  mode 
) [virtual]

XML loading and saving.

Parameters:
xmlelement The XML-element
loading Loading (true) or saving (false)
Returns:
The XML-element

Reimplemented from orxonox::BaseObject.

Reimplemented in orxonox::PickupSpawner, orxonox::QuestEffectBeacon, orxonox::Weapon, orxonox::WeaponSlot, orxonox::Attacher, orxonox::Backlight, orxonox::Billboard, orxonox::BlinkingBillboard, orxonox::CameraPosition, orxonox::ControllableEntity, orxonox::FadingBillboard, orxonox::ForceField, orxonox::Light, orxonox::MobileEntity, orxonox::Model, orxonox::MovableEntity, orxonox::ParticleEmitter, orxonox::ParticleSpawner, orxonox::Pawn, orxonox::SpaceShip, orxonox::Planet, orxonox::PongCenterpoint, orxonox::SpawnPoint, orxonox::TeamSpawnPoint, orxonox::CheckPoint, orxonox::DistanceTrigger, orxonox::PlayerTrigger, and orxonox::Trigger.

References attach(), attachCollisionShape(), getAngularDamping(), getAngularFactor(), getAttachedCollisionShape(), getAttachedObject(), getCollisionTypeStr(), getDeleteWithParent(), getFriction(), getLinearDamping(), getMass(), getOrientation(), getPosition(), getRestitution(), getScale(), getScale3D(), hasCollisionResponse(), lookAt_xmlport(), pitch_xmlport(), orxonox::MT_Type::Quaternion, roll_xmlport(), setAngularDamping(), setAngularFactor(), setCollisionResponse(), setCollisionTypeStr(), setDeleteWithParent(), setDirection_xmlport(), setFriction(), setLinearDamping(), setMass(), setOrientation(), setPosition(), setRestitution(), setScale(), setScale3D(), SUPER, orxonox::MT_Type::Vector3, XMLPortObject, XMLPortParam, XMLPortParamLoadOnly, XMLPortParamTemplate, and yaw_xmlport().

void orxonox::WorldEntity::yaw ( const Degree &  angle,
TransformSpace  relativeTo = WorldEntity::Local 
) [inline]

void orxonox::WorldEntity::yaw_xmlport ( const Degree &  angle  )  [inline, private]

Referenced by XMLPort().


Friends And Related Function Documentation

friend class Scene [friend]


Member Data Documentation

const Vector3 orxonox::WorldEntity::BACK = Vector3::UNIT_Z [static]

Tells whether the object should respond to collisions.

Referenced by collisionResponseActivityChanged(), registerVariables(), and WorldEntity().

Referenced by WorldEntity().

When attaching objects hierarchically this variable tells this object (as child) whether physics was activated before attaching (because the deactivate physics while being attached).

Referenced by notifyBeingAttached(), notifyDetached(), and WorldEntity().

Network synchronised variable for bPhysicsActive_

Referenced by activatePhysics(), deactivatePhysics(), physicsActivityChanged(), registerVariables(), and WorldEntity().

Sum of all the children's masses.

Referenced by attach(), detach(), notifyChildMassChanged(), recalculateMassProps(), and WorldEntity().

Network synchronised variable for collisionType_.

Referenced by collisionTypeChanged(), registerVariables(), setCollisionType(), and WorldEntity().

const Vector3 orxonox::WorldEntity::DOWN = Vector3::NEGATIVE_UNIT_Y [static]

btScalar orxonox::WorldEntity::friction_ [private]

const Vector3 orxonox::WorldEntity::FRONT = Vector3::NEGATIVE_UNIT_Z [static]

const Vector3 orxonox::WorldEntity::LEFT = Vector3::NEGATIVE_UNIT_X [static]

See also:
getLocalInertia

Referenced by recalculateMassProps().

btScalar orxonox::WorldEntity::mass_ [private]

Ogre::SceneNode* orxonox::WorldEntity::node_ [protected]

unsigned int orxonox::WorldEntity::parentID_ [private]

btRigidBody* orxonox::WorldEntity::physicalBody_ [protected]

const Vector3 orxonox::WorldEntity::RIGHT = Vector3::UNIT_X [static]

const Vector3 orxonox::WorldEntity::UP = Vector3::UNIT_Y [static]


The documentation for this class was generated from the following files:

Generated on Tue Jul 28 16:23:18 2009 for Orxonox by  doxygen 1.5.6