Orxonox
0.0.5 Codename: Arcturus
|
The WorldEntity represents everything that can be put in a Scene at a certain location. More...
#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/orxonox/worldentities/WorldEntity.h>
Public Types | |
enum | CollisionType { CollisionType::Dynamic, CollisionType::Kinematic, CollisionType::Static, CollisionType::None } |
Denotes the possible types of physical objects in a Scene. More... | |
enum | TransformSpace { TransformSpace::Local, TransformSpace::Parent, TransformSpace::World } |
Enumeration denoting the spaces which a transform can be relative to. More... | |
Public Member Functions | |
WorldEntity (Context *context) | |
Creates a new WorldEntity that may immediately be used. More... | |
virtual | ~WorldEntity () |
Destroys the WorldEntity AND ALL its children with it. More... | |
void | activatePhysics () |
Activates physics if the CollisionType is not None. More... | |
bool | addedToPhysicalWorld () const |
Tells whether the object has already been added to the Bullet physics World. More... | |
void | attach (WorldEntity *object) |
Attaches a child WorldEntity to this object. More... | |
void | attachCollisionShape (CollisionShape *shape) |
Attaches a collision Shape to this object (delegated to the internal CompoundCollisionShape) More... | |
void | attachNode (Ogre::SceneNode *node) |
Attaches an Ogre::SceneNode to this WorldEntity. More... | |
void | attachOgreObject (Ogre::MovableObject *object) |
Attaches an Ogre::MovableObject to this WorldEntity. More... | |
void | attachOgreObject (Ogre::BillboardSet *object) |
void | attachOgreObject (Ogre::Camera *object) |
void | attachOgreObject (Ogre::Entity *object) |
void | attachOgreObject (Ogre::ParticleSystem *object) |
void | attachToNode (Ogre::SceneNode *node) |
Attaches this object to a parent SceneNode. More... | |
void | attachToParent (WorldEntity *parent) |
BT_DECLARE_ALIGNED_ALLOCATOR () | |
virtual void | changedActivity (void) override |
When the activity is changed, it is changed for all attached objects as well. More... | |
virtual void | changedScale () |
virtual void | changedVisibility (void) override |
When the visibility is changed, it is changed for all attached objects as well. More... | |
virtual bool | collidesAgainst (WorldEntity *otherObject, const btCollisionShape *ownCollisionShape, btManifoldPoint &contactPoint) |
Virtual function that gets called when this object collides with another. More... | |
void | deactivatePhysics () |
Deactivates physics but the CollisionType does not change. More... | |
void | detach (WorldEntity *object) |
Detaches a child WorldEntity from this instance. More... | |
void | detachCollisionShape (CollisionShape *shape) |
Detaches a collision Shape from this object (delegated to the internal CompoundCollisionShape) More... | |
void | detachFromNode (Ogre::SceneNode *node) |
Detaches this object from a parent SceneNode. More... | |
void | detachFromParent () |
void | detachNode (Ogre::SceneNode *node) |
Detaches an Ogre::SceneNode from this WorldEntity. More... | |
void | detachOgreObject (Ogre::MovableObject *object) |
Detaches an Ogre::MovableObject from this WorldEntity. More... | |
void | detachOgreObject (Ogre::BillboardSet *object) |
void | detachOgreObject (Ogre::Camera *object) |
void | detachOgreObject (Ogre::Entity *object) |
void | detachOgreObject (Ogre::ParticleSystem *object) |
Ogre::MovableObject * | detachOgreObject (const Ogre::String &name) |
Detaches an Ogre::MovableObject (by string) from this WorldEntity. More... | |
void | disableCollisionCallback () |
Disables the collidesAgainst(.) function. More... | |
void | enableCollisionCallback () |
Enables the collidesAgainst(.) function. The object doesn't respond to collision otherwise! More... | |
float | getAngularDamping () const |
Returns the angular damping. More... | |
float | getAngularFactor () const |
Returns the angular factor. More... | |
CollisionShape * | getAttachedCollisionShape (unsigned int index) |
Returns an attached collision Shape of this object (delegated to the internal CompoundCollisionShape) More... | |
WorldEntity * | getAttachedObject (unsigned int index) |
Returns an attached object (merely for XMLPort). More... | |
const std::set< WorldEntity * > & | getAttachedObjects () const |
float | getCcdMotionThreshold () const |
Returns the currently used motion threshold for CCD (0 means CCD is deactivated). More... | |
float | getCcdSweptSphereRadius () const |
Returns the currently used radius of the sphere for CCD. More... | |
CollisionType | getCollisionType () const |
Returns the CollisionType. More... | |
std::string | getCollisionTypeStr () const |
Gets the CollisionType by string (used for the XMLPort) More... | |
bool | getDeleteWithParent () const |
float | getFriction () const |
Returns the amount of friction applied to the object. More... | |
std::string | getID (void) |
float | getLinearDamping () const |
Returns the linear damping. More... | |
const btVector3 & | getLocalInertia () const |
Returns the diagonal elements of the inertia tensor when calculated in local coordinates. More... | |
float | getMass () const |
Returns the mass of this object without its children. More... | |
const Ogre::SceneNode * | getNode () const |
const Quaternion & | getOrientation () const |
WorldEntity * | getParent () const |
const Vector3 & | getPosition () const |
float | getRestitution () const |
Returns the restitution parameter. More... | |
float | getScale () const |
const Vector3 & | getScale3D () const |
float | getTotalMass () const |
Returns the total mass of this object with all its attached children. More... | |
virtual const Vector3 & | getVelocity () const |
const Quaternion & | getWorldOrientation () const |
Returns the orientation relative to the root space. More... | |
const Vector3 & | getWorldPosition () const |
Returns the position relative to the root space. More... | |
float | getWorldScale () const |
Returns the scaling applied relative to the root space in 3 coordinates. More... | |
const Vector3 & | getWorldScale3D () const |
Returns the scaling applied relative to the root space in 3 coordinates. More... | |
bool | hasCollisionResponse () |
Tells whether there could be a collision response. More... | |
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. More... | |
bool | isCollisionCallbackActive () const |
Tells whether there could be a collision callback via collidesAgainst(.) More... | |
bool | isDynamic () const |
bool | isKinematic () const |
bool | isPhysicsActive () const |
Tells whether physics has been activated (you can temporarily deactivate it) More... | |
bool | isStatic () const |
void | lookAt (const Vector3 &target, TransformSpace relativeTo=TransformSpace::Parent, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) |
Makes this WorldEntity look at a specific target location. More... | |
void | notifyChildMassChanged () |
Recalculates the accumulated child mass and calls recalculateMassProps() and notifies the parent of the change. More... | |
void | notifyChildPropsChanged () |
void | notifyCollisionShapeChanged () |
Undertakes the necessary steps to change the collision shape in Bullet, even at runtime. More... | |
void | pitch (const Degree &angle, TransformSpace relativeTo=TransformSpace::Local) |
void | roll (const Degree &angle, TransformSpace relativeTo=TransformSpace::Local) |
void | rotate (const Quaternion &rotation, TransformSpace relativeTo=TransformSpace::Local) |
Rotates this WorldEntity by a quaternion. More... | |
void | rotate (const Vector3 &axis, const Degree &angle, TransformSpace relativeTo=TransformSpace::Local) |
void | scale (float scale) |
void | scale3D (const Vector3 &scale) |
void | scale3D (float x, float y, float z) |
void | setAngularDamping (float angularDamping) |
Applies a tensor independent rotation damping. Angular velocities will simply diminish exponentially. More... | |
void | setAngularFactor (float angularFactor) |
Sets an artificial parameter that tells how much torque is applied when you apply a non-central force. More... | |
void | setCcdMotionThreshold (float ccdMotionThreshold) |
Sets the motion threshold for continuous collision detection (CCD). More... | |
void | setCcdSweptSphereRadius (float ccdSweptSphereRadius) |
Sets the radius of the sphere which is used for continuous collision detection (CCD). More... | |
void | setCollisionResponse (bool value) |
Enables or disables collision response (default is of course on) More... | |
void | setCollisionType (CollisionType type) |
Sets the CollisionType. More... | |
void | setCollisionTypeStr (const std::string &type) |
Sets the CollisionType by string (used for the XMLPort) More... | |
void | setDeleteWithParent (bool value) |
void | setDirection (const Vector3 &direction, TransformSpace relativeTo=TransformSpace::Local, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) |
Makes this WorldEntity look in specific direction. More... | |
void | setDirection (float x, float y, float z, TransformSpace relativeTo=TransformSpace::Local, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) |
void | setFriction (float friction) |
Applies friction to the object. Friction occurs when two objects collide. More... | |
void | setID (std::string id) |
void | setLinearDamping (float linearDamping) |
Applies a mass independent damping. Velocities will simply diminish exponentially. More... | |
void | setMass (float mass) |
Sets the mass of this object. Note that the total mass may be influenced by attached objects! More... | |
virtual void | setOrientation (const Quaternion &orientation)=0 |
void | setOrientation (float w, float x, float y, float z) |
void | setOrientation (const Vector3 &axis, const Radian &angle) |
void | setOrientation (const Vector3 &axis, const Degree &angle) |
virtual void | setPosition (const Vector3 &position)=0 |
void | setPosition (float x, float y, float z) |
void | setRestitution (float restitution) |
Sets how much reaction is applied in a collision. More... | |
void | setScale (float scale) |
virtual void | setScale3D (const Vector3 &scale) |
Sets the three dimensional scaling of this object. More... | |
void | setScale3D (float x, float y, float z) |
void | translate (const Vector3 &distance, TransformSpace relativeTo=TransformSpace::Parent) |
Translates this WorldEntity by a vector. More... | |
void | translate (float x, float y, float z, TransformSpace relativeTo=TransformSpace::Parent) |
virtual void | XMLPort (Element &xmlelement, XMLPort::Mode mode) override |
XML loading and saving. More... | |
void | yaw (const Degree &angle, TransformSpace relativeTo=TransformSpace::Local) |
Public Member Functions inherited from orxonox::BaseObject | |
BaseObject (Context *context) | |
Constructor: Registers the object in the BaseObject-list. More... | |
virtual | ~BaseObject () |
Destructor. More... | |
void | addEventListener (BaseObject *listener) |
Adds an object which listens to the events of this object. More... | |
void | addEventSource (BaseObject *source, const std::string &state) |
Adds a new event source for a specific state. More... | |
void | addTemplate (const std::string &name) |
Adds a Template to the object. More... | |
void | addTemplate (Template *temp) |
Adds a Template to the object. More... | |
virtual void | changedMainStateName () |
This function gets called if the main state name of the object changes. More... | |
virtual void | changedName () |
This function gets called if the name of the object changes. More... | |
void | fireEvent (const std::string &name="") |
Fires an event (without a state). More... | |
void | fireEvent (bool activate, const std::string &name="") |
Fires an event which activates or deactivates a state. More... | |
void | fireEvent (bool activate, BaseObject *originator, const std::string &name="") |
Fires an event which activates or deactivates a state with agiven originator (the object which triggered the event). More... | |
void | fireEvent (Event &event) |
Fires an event, using the Event struct. More... | |
BaseObject * | getCreator () const |
BaseObject * | getEventListener (unsigned int index) const |
Returns an event listener with a given index. More... | |
BaseObject * | getEventSource (unsigned int index, const std::string &state) const |
Returns an eventsource with a given index. More... | |
const XMLFile * | getFile () const |
Returns a pointer to the XMLFile that loaded this object. More... | |
const std::string & | getFilename () const |
Returns the levelfile that loaded this object. More... | |
Gametype * | getGametype () const |
Level * | getLevel () const |
const std::string & | getLoaderIndentation () const |
Returns the indentation of the debug output in the Loader. More... | |
const std::string & | getMainStateName () const |
Returns the name of the main state. More... | |
const std::string & | getName () const |
Returns the name of the object. More... | |
Namespace * | getNamespace () const |
const std::string & | getOldName () const |
Returns the old name of the object. More... | |
Scene * | getScene () const |
virtual uint32_t | getSceneID () const |
const std::set< Template * > & | getTemplates () const |
Returns the set of all aplied templates. More... | |
const mbool & | isActive () const |
Returns the state of the objects activity. More... | |
bool | isInitialized () const |
Returns if the object was initialized (passed the object registration). More... | |
const mbool & | isVisible () const |
Returns the state of the objects visibility. More... | |
virtual void | processEvent (Event &event) |
Processing an event by calling the right main state. More... | |
void | removeEventSource (BaseObject *source) |
Removes an eventsource (but doesn't unregister itself at the source). More... | |
void | setActive (bool bActive) |
Sets the state of the objects activity. More... | |
void | setCreator (BaseObject *creator) |
void | setFile (const XMLFile *file) |
Sets a pointer to the xml file that loaded this object. More... | |
void | setGametype (const StrongOrWeakPtr< Gametype > &gametype) |
void | setLevel (const StrongOrWeakPtr< Level > &level) |
void | setLoaderIndentation (const std::string &indentation) |
Sets the indentation of the debug output in the Loader. More... | |
void | setMainState (bool state) |
Sets the main state of the object to a given boolean value. More... | |
void | setMainStateName (const std::string &name) |
Sets the name of the main state (used for event reactions). More... | |
void | setName (const std::string &name) |
Sets the name of the object. More... | |
void | setNamespace (const StrongOrWeakPtr< Namespace > &ns) |
void | setScene (const StrongOrWeakPtr< Scene > &scene, uint32_t sceneID) |
void | setVisible (bool bVisible) |
Sets the state of the objects visibility. More... | |
virtual void | XMLEventPort (Element &xmlelement, XMLPort::Mode mode) |
Defines the possible event states of this object and parses eventsources from an XML file. More... | |
Public Member Functions inherited from orxonox::OrxonoxClass | |
OrxonoxClass () | |
OrxonoxClass & | operator= (const OrxonoxClass &)=default |
Public Member Functions inherited from orxonox::Configurable | |
Configurable () | |
void | setConfigValues () |
Function to collect the SetConfigValue-macro calls. More... | |
Public Member Functions inherited from orxonox::Listable | |
Listable () | |
Constructor: Allocates space in the element list. More... | |
Listable (Context *context) | |
Constructor: Allocates space in the element list and assigns the context. More... | |
virtual | ~Listable () |
Destructor: Removes the object from the object-lists. More... | |
Context * | getContext () const |
void | setContext (Context *context) |
Changes the context. More... | |
void | unregisterObject () |
Removes this object from the object-lists. More... | |
Public Member Functions inherited from orxonox::Identifiable | |
Identifiable () | |
Constructor: Sets the default values. More... | |
virtual | ~Identifiable () |
ORX_FORCEINLINE void * | getDerivedPointer (unsigned int classID) |
Returns a valid pointer of any derived type that is registered in the class hierarchy. More... | |
template<class T > | |
ORX_FORCEINLINE T * | getDerivedPointer (unsigned int classID) |
Version of getDerivedPointer with template. More... | |
template<class T > | |
ORX_FORCEINLINE const T * | getDerivedPointer (unsigned int classID) const |
Const version of getDerivedPointer with template. More... | |
Identifier * | getIdentifier () const |
Returns the Identifier of the object. More... | |
bool | isA (const Identifier *identifier) |
Returns true if the object's class is of the given type or a derivative. More... | |
template<class B > | |
bool | isA (const SubclassIdentifier< B > *identifier) |
Returns true if the object's class is of the given type or a derivative. More... | |
bool | isA (const Identifiable *object) |
Returns true if the object's class is of the given type or a derivative. More... | |
bool | isChildOf (const Identifier *identifier) |
Returns true if the object's class is a child of the given type. More... | |
template<class B > | |
bool | isChildOf (const SubclassIdentifier< B > *identifier) |
Returns true if the object's class is a child of the given type. More... | |
bool | isChildOf (const Identifiable *object) |
Returns true if the object's class is a child of the given type. More... | |
bool | isDirectChildOf (const Identifier *identifier) |
Returns true if the object's class is a direct child of the given type. More... | |
template<class B > | |
bool | isDirectChildOf (const SubclassIdentifier< B > *identifier) |
Returns true if the object's class is a direct child of the given type. More... | |
bool | isDirectChildOf (const Identifiable *object) |
Returns true if the object's class is a direct child of the given type. More... | |
bool | isDirectParentOf (const Identifier *identifier) |
Returns true if the object's class is a direct parent of the given type. More... | |
template<class B > | |
bool | isDirectParentOf (const SubclassIdentifier< B > *identifier) |
Returns true if the object's class is a direct parent of the given type. More... | |
bool | isDirectParentOf (const Identifiable *object) |
Returns true if the object's class is a direct child of the given type. More... | |
bool | isExactlyA (const Identifier *identifier) |
Returns true if the object's class is exactly of the given type. More... | |
template<class B > | |
bool | isExactlyA (const SubclassIdentifier< B > *identifier) |
Returns true if the object's class is exactly of the given type. More... | |
bool | isExactlyA (const Identifiable *object) |
Returns true if the object's class is exactly of the given type. More... | |
bool | isParentOf (const Identifier *identifier) |
Returns true if the object's class is a parent of the given type. More... | |
template<class B > | |
bool | isParentOf (const SubclassIdentifier< B > *identifier) |
Returns true if the object's class is a parent of the given type. More... | |
bool | isParentOf (const Identifiable *object) |
Returns true if the object's class is a parent of the given type. More... | |
Public Member Functions inherited from orxonox::Destroyable | |
Destroyable () | |
Constructor: Sets the default values. More... | |
virtual | ~Destroyable () |
Destructor: Notifies all DestructionListener (for example weak pointers) that this object is being deleted. More... | |
void | destroy () |
Deletes the object if no strong pointers point to this object. More... | |
void | destroyLater () |
Works like destroy() but doesn't destroy the object until the current tick has ended. More... | |
unsigned int | getReferenceCount () const |
Returns the number of strong pointers that point to this object. More... | |
Public Member Functions inherited from orxonox::Synchronisable | |
virtual | ~Synchronisable () |
Destructor: Delete all callback objects and remove objectID_ from the objectMap_. More... | |
uint32_t | getClassID () const |
unsigned int | getContextID () const |
uint32_t | getNrOfVariables () |
uint32_t | getObjectID () const |
unsigned int | getPriority () const |
uint8_t | getSyncMode () const |
uint32_t | getVarSize (VariableID ID) |
template<> | |
_NetworkExport void | registerVariable (std::string &variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional) |
template<> | |
void | registerVariable (std::string &variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional) |
void | setSyncMode (uint8_t mode) |
This function sets the synchronisation mode of the object If set to 0x0 variables will not be synchronised at all If set to 0x1 variables will only be synchronised to the client If set to 0x2 variables will only be synchronised to the server If set to 0x3 variables will be synchronised bidirectionally (only if set so in registerVar) More... | |
template<> | |
_NetworkExport void | unregisterVariable (std::string &variable) |
template<> | |
void | unregisterVariable (std::string &variable) |
Public Member Functions inherited from orxonox::OrxonoxInterface | |
OrxonoxInterface () | |
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. More... | |
virtual void | parentChanged () |
Protected Member Functions inherited from orxonox::BaseObject | |
void | addEventState (const std::string &name, EventState *container) |
Adds a new event-state to the object. More... | |
EventState * | getEventState (const std::string &name) const |
Returns the event-state with the given name. More... | |
Protected Member Functions inherited from orxonox::Destroyable | |
virtual void | preDestroy () |
This virtual function is called if destroy() is called and no StrongPtr points to this object. More... | |
Protected Member Functions inherited from orxonox::Synchronisable | |
Synchronisable (Context *context) | |
Constructor: Initializes all Variables and sets the right objectID_. More... | |
uint32_t | findContextID (Context *context) |
Returns the id of the context. More... | |
template<class T > | |
void | registerVariable (T &variable, uint8_t mode=0x1, NetworkCallbackBase *cb=nullptr, bool bidirectional=false) |
template<class T > | |
void | registerVariable (std::set< T > &variable, uint8_t mode=0x1, NetworkCallbackBase *cb=nullptr, bool bidirectional=false) |
void | setPriority (unsigned int freq) |
template<class T > | |
void | unregisterVariable (T &var) |
Protected Attributes | |
std::string | id_ |
Used by the ScriptableController to identify objects. More... | |
Ogre::SceneNode * | node_ |
btRigidBody * | physicalBody_ |
Bullet rigid body. Everything physical is applied to this instance. More... | |
Protected Attributes inherited from orxonox::BaseObject | |
mbool | bActive_ |
True = the object is active. More... | |
mbool | bVisible_ |
True = the object is visible. More... | |
FunctorPtr | mainStateFunctor_ |
std::string | mainStateName_ |
std::string | name_ |
The name of the object. More... | |
std::set< std::string > | networkTemplateNames_ |
std::string | oldName_ |
The old name of the object. More... | |
Private Member Functions | |
void | angularDampingChanged () |
Network callback workaround to call a function when the value changes. More... | |
void | angularFactorChanged () |
Network callback workaround to call a function when the value changes. More... | |
void | ccdMotionThresholdChanged () |
Network callback workaround to call a function when the value changes. More... | |
void | ccdSweptSphereRadiusChanged () |
Network callback workaround to call a function when the value changes. More... | |
void | collisionCallbackActivityChanged () |
Function sets whether Bullet should issue a callback on collisions. More... | |
void | collisionResponseActivityChanged () |
Function sets whether Bullet should react itself to a collision. More... | |
void | collisionTypeChanged () |
Network callback for the collision type. More... | |
void | frictionChanged () |
Network callback workaround to call a function when the value changes. More... | |
void | internalSetPhysicsProps () |
Copies our own parameters for restitution, angular factor, damping and friction to the bullet rigid body. More... | |
void | linearDampingChanged () |
Network callback workaround to call a function when the value changes. More... | |
void | lookAt_xmlport (const Vector3 &target) |
void | massChanged () |
Network callback workaround to call a function when the value changes. More... | |
void | networkcallback_parentChanged () |
Network function that object this instance to its correct parent. More... | |
bool | notifyBeingAttached (WorldEntity *newParent) |
Function gets called when this object is being attached to a new parent. More... | |
void | notifyDetached () |
Function gets called when the object has been detached from its parent. More... | |
void | physicsActivityChanged () |
Network callback for this->bPhysicsActive_. More... | |
void | pitch_xmlport (const Degree &angle) |
void | recalculateMassProps () |
Updates all mass dependent parameters (mass, inertia tensor and child mass) More... | |
void | registerVariables () |
void | restitutionChanged () |
Network callback workaround to call a function when the value changes. More... | |
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 | bActiveMem_ |
bool | bCollisionCallbackActive_ |
bool | bCollisionResponseActive_ |
Tells whether the object should respond to collisions. More... | |
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). More... | |
bool | bPhysicsActiveSynchronised_ |
Network synchronised variable for bPhysicsActive_. More... | |
bool | bVisibleMem_ |
btScalar | ccdMotionThreshold_ |
btScalar | ccdSweptSphereRadius_ |
std::set< WorldEntity * > | children_ |
btScalar | childrenMass_ |
Sum of all the children's masses. More... | |
WorldEntityCollisionShape * | collisionShape_ |
Attached collision shapes go here. More... | |
CollisionType | collisionType_ |
CollisionType | collisionTypeSynchronised_ |
Network synchronised variable for collisionType_. More... | |
btScalar | friction_ |
btScalar | linearDamping_ |
btVector3 | localInertia_ |
btScalar | mass_ |
WorldEntity * | parent_ |
unsigned int | parentID_ |
btScalar | restitution_ |
Friends | |
class | Scene |
Additional Inherited Members | |
Static Public Member Functions inherited from orxonox::BaseObject | |
static void | loadAllEventStates (Element &xmlelement, XMLPort::Mode mode, BaseObject *object, Identifier *identifier) |
Manually loads all event states, even if the class doesn't officially support them. More... | |
Static Public Member Functions inherited from orxonox::Synchronisable | |
static bool | deleteObject (uint32_t objectID_) |
Finds and deletes the Synchronisable with the appropriate objectID_. More... | |
static Synchronisable * | fabricate (uint8_t *&mem, uint8_t mode=0x0) |
This function fabricated a new synchrnisable (and children of it), sets calls updateData and create After calling this function the mem pointer will be increased by the size of the needed data. More... | |
static unsigned int | getNumberOfDeletedObject () |
static Synchronisable * | getSynchronisable (uint32_t objectID_) |
This function looks up the objectID_ in the objectMap_ and returns a pointer to the right Synchronisable. More... | |
static uint32_t | popDeletedObject () |
static void | setClient (bool b) |
This function sets the internal mode for synchronisation. More... | |
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 derived objects. It is also the basis for the physics interface to the Bullet physics engine. Every WorldEntity can have a specific collision type:
Collision shapes: These are controlled by the internal WorldEntityCollisionShape.
|
strong |
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 |
|
strong |
orxonox::WorldEntity::WorldEntity | ( | Context * | context | ) |
Creates a new WorldEntity that may immediately be used.
All the default values are being set here.
|
virtual |
Destroys the WorldEntity AND ALL its children with it.
void orxonox::WorldEntity::activatePhysics | ( | ) |
Activates physics if the CollisionType is not None.
bool orxonox::WorldEntity::addedToPhysicalWorld | ( | ) | const |
Tells whether the object has already been added to the Bullet physics World.
|
inlineprivate |
Network callback workaround to call a function when the value changes.
|
inlineprivate |
Network callback workaround to call a function when the value changes.
void orxonox::WorldEntity::attach | ( | WorldEntity * | object | ) |
Attaches a child WorldEntity to this object.
This calls notifyBeingAttached() of the child WE.
void orxonox::WorldEntity::attachCollisionShape | ( | CollisionShape * | shape | ) |
Attaches a collision Shape to this object (delegated to the internal CompoundCollisionShape)
void orxonox::WorldEntity::attachNode | ( | Ogre::SceneNode * | node | ) |
Attaches an Ogre::SceneNode to this WorldEntity.
void orxonox::WorldEntity::attachOgreObject | ( | Ogre::MovableObject * | object | ) |
Attaches an Ogre::MovableObject to this WorldEntity.
void orxonox::WorldEntity::attachOgreObject | ( | Ogre::BillboardSet * | object | ) |
void orxonox::WorldEntity::attachOgreObject | ( | Ogre::Camera * | object | ) |
void orxonox::WorldEntity::attachOgreObject | ( | Ogre::Entity * | object | ) |
void orxonox::WorldEntity::attachOgreObject | ( | Ogre::ParticleSystem * | object | ) |
void orxonox::WorldEntity::attachToNode | ( | Ogre::SceneNode * | node | ) |
Attaches this object to a parent SceneNode.
|
inline |
orxonox::WorldEntity::BT_DECLARE_ALIGNED_ALLOCATOR | ( | ) |
|
inlineprivate |
Network callback workaround to call a function when the value changes.
|
inlineprivate |
Network callback workaround to call a function when the value changes.
When the activity is changed, it is changed for all attached objects as well.
Reimplemented from orxonox::BaseObject.
Reimplemented in orxonox::PortalEndPoint, orxonox::CheckPoint, orxonox::Attacher, orxonox::WorldSound, orxonox::FadingBillboard, and orxonox::ParticleEmitter.
|
inlinevirtual |
Reimplemented in orxonox::Backlight.
When the visibility is changed, it is changed for all attached objects as well.
Reimplemented from orxonox::BaseObject.
Reimplemented in orxonox::Pawn, orxonox::LensFlare, orxonox::Trigger, orxonox::BillboardProjectile, orxonox::Model, orxonox::Light, orxonox::Planet, orxonox::Attacher, orxonox::ParticleProjectile, orxonox::Billboard, orxonox::FadingBillboard, orxonox::Backlight, and orxonox::ParticleEmitter.
|
inlinevirtual |
Virtual function that gets called when this object collides with another.
otherObject | The object this one has collided into. |
ownCollisionShape | The collision shape of the other object |
contactPoint | Contact point provided by Bullet. Holds more information and can me modified. See return value. |
Reimplemented in orxonox::DodgeRaceShip, orxonox::OrxyRoadShip, orxonox::FpsPlayer, orxonox::HoverShip, orxonox::Projectile, orxonox::InvaderShip, orxonox::Rocket, orxonox::RocketOld, orxonox::SimpleRocket, orxonox::IceGunProjectile, orxonox::Asteroids2DShip, orxonox::Asteroids2DStone, orxonox::WagnisProjectile, orxonox::OrxoKartFlag, orxonox::OrxoKartTile, orxonox::HoverFlag, orxonox::SOBFireball, orxonox::SOBTube, orxonox::SOBFlagstone, orxonox::SOBItem, orxonox::InvaderEnemy, orxonox::SOBGumba, orxonox::SOBGumbaBoss, orxonox::SOBMushroom, orxonox::MovableEntity, orxonox::SOBFigure, orxonox::SOBCastlestone, orxonox::GravityBomb, orxonox::ShootableObstacle, and orxonox::SOBQBlock.
|
private |
Function sets whether Bullet should issue a callback on collisions.
|
private |
Function sets whether Bullet should react itself to a collision.
|
private |
Network callback for the collision type.
Only change the type if it was valid.
void orxonox::WorldEntity::deactivatePhysics | ( | ) |
Deactivates physics but the CollisionType does not change.
void orxonox::WorldEntity::detach | ( | WorldEntity * | object | ) |
Detaches a child WorldEntity from this instance.
void orxonox::WorldEntity::detachCollisionShape | ( | CollisionShape * | shape | ) |
Detaches a collision Shape from this object (delegated to the internal CompoundCollisionShape)
void orxonox::WorldEntity::detachFromNode | ( | Ogre::SceneNode * | node | ) |
Detaches this object from a parent SceneNode.
|
inline |
void orxonox::WorldEntity::detachNode | ( | Ogre::SceneNode * | node | ) |
Detaches an Ogre::SceneNode from this WorldEntity.
void orxonox::WorldEntity::detachOgreObject | ( | Ogre::MovableObject * | object | ) |
Detaches an Ogre::MovableObject from this WorldEntity.
void orxonox::WorldEntity::detachOgreObject | ( | Ogre::BillboardSet * | object | ) |
void orxonox::WorldEntity::detachOgreObject | ( | Ogre::Camera * | object | ) |
void orxonox::WorldEntity::detachOgreObject | ( | Ogre::Entity * | object | ) |
void orxonox::WorldEntity::detachOgreObject | ( | Ogre::ParticleSystem * | object | ) |
Ogre::MovableObject * orxonox::WorldEntity::detachOgreObject | ( | const Ogre::String & | name | ) |
Detaches an Ogre::MovableObject (by string) from this WorldEntity.
|
inline |
Disables the collidesAgainst(.) function.
|
inline |
Enables the collidesAgainst(.) function. The object doesn't respond to collision otherwise!
|
inlineprivate |
Network callback workaround to call a function when the value changes.
|
inline |
Returns the angular damping.
|
inline |
Returns the angular factor.
CollisionShape * orxonox::WorldEntity::getAttachedCollisionShape | ( | unsigned int | index | ) |
Returns an attached collision Shape of this object (delegated to the internal CompoundCollisionShape)
WorldEntity * orxonox::WorldEntity::getAttachedObject | ( | unsigned int | index | ) |
Returns an attached object (merely for XMLPort).
|
inline |
|
inline |
Returns the currently used motion threshold for CCD (0 means CCD is deactivated).
|
inline |
Returns the currently used radius of the sphere for CCD.
|
inline |
Returns the CollisionType.
std::string orxonox::WorldEntity::getCollisionTypeStr | ( | ) | const |
Gets the CollisionType by string (used for the XMLPort)
|
inline |
|
inline |
Returns the amount of friction applied to the object.
|
inline |
|
inline |
Returns the linear damping.
|
inline |
Returns the diagonal elements of the inertia tensor when calculated in local coordinates.
|
inline |
Returns the mass of this object without its children.
|
inline |
const Quaternion & orxonox::WorldEntity::getOrientation | ( | ) | const |
|
inline |
const Vector3 & orxonox::WorldEntity::getPosition | ( | void | ) | const |
|
inline |
Returns the restitution parameter.
|
inline |
const Vector3 & orxonox::WorldEntity::getScale3D | ( | ) | const |
|
inline |
Returns the total mass of this object with all its attached children.
|
inlinevirtual |
Reimplemented in orxonox::MobileEntity.
const Quaternion & orxonox::WorldEntity::getWorldOrientation | ( | ) | const |
Returns the orientation relative to the root space.
const Vector3 & orxonox::WorldEntity::getWorldPosition | ( | ) | const |
Returns the position relative to the root space.
float orxonox::WorldEntity::getWorldScale | ( | ) | const |
Returns the scaling applied relative to the root space in 3 coordinates.
const Vector3 & orxonox::WorldEntity::getWorldScale3D | ( | ) | const |
Returns the scaling applied relative to the root space in 3 coordinates.
|
inline |
Tells whether there could be a collision response.
|
inline |
Tells whether the object has any connection to the Bullet physics engine. If hasPhysics() is false, the object may still have a velocity.
|
private |
Copies our own parameters for restitution, angular factor, damping and friction to the bullet rigid body.
|
inline |
Tells whether there could be a collision callback via collidesAgainst(.)
|
protectedpure 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 class's virtual functions don't yet exist in the constructor if a base class.
Implemented in orxonox::SpaceShip, orxonox::MobileEntity, orxonox::FpsPlayer, and orxonox::StaticEntity.
|
inline |
|
inline |
|
inline |
Tells whether physics has been activated (you can temporarily deactivate it)
|
inline |
|
inlineprivate |
Network callback workaround to call a function when the value changes.
void orxonox::WorldEntity::lookAt | ( | const Vector3 & | target, |
TransformSpace | relativeTo = TransformSpace::Parent , |
||
const Vector3 & | localDirectionVector = Vector3::NEGATIVE_UNIT_Z |
||
) |
Makes this WorldEntity look at a specific target location.
target | An absolute point in the space which defines the direction of the entity |
relativeTo | The TransformSpace of this translation |
localDirectionVector | The vector which normally describes the natural direction of the object, usually -Z. |
|
inlineprivate |
|
inlineprivate |
Network callback workaround to call a function when the value changes.
|
private |
Network function that object this instance to its correct parent.
|
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.
void orxonox::WorldEntity::notifyChildMassChanged | ( | ) |
Recalculates the accumulated child mass and calls recalculateMassProps() and notifies the parent of the change.
void orxonox::WorldEntity::notifyChildPropsChanged | ( | ) |
void orxonox::WorldEntity::notifyCollisionShapeChanged | ( | ) |
Undertakes the necessary steps to change the collision shape in Bullet, even at runtime.
|
private |
Function gets called when the object has been detached from its parent.
|
inlineprotectedvirtual |
Reimplemented in orxonox::ControllableEntity.
|
private |
Network callback for this->bPhysicsActive_.
|
inline |
|
inlineprivate |
|
private |
Updates all mass dependent parameters (mass, inertia tensor and child mass)
|
inlineprivate |
Network callback workaround to call a function when the value changes.
|
inline |
|
inlineprivate |
void orxonox::WorldEntity::rotate | ( | const Quaternion & | rotation, |
TransformSpace | relativeTo = TransformSpace::Local |
||
) |
Rotates this WorldEntity by a quaternion.
rotation | The desired relative rotation |
relativeTo | The TransformSpace of this translation |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
|
inline |
Applies a tensor independent rotation damping. Angular velocities will simply diminish exponentially.
|
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'. However if you have a player character that should not rotate when hit sideways, you can set the angular factor to 0.
|
inline |
Sets the motion threshold for continuous collision detection (CCD).
This should be activated if an object moves further in one tick than its own size. This means that in one tick the object may be in front of a wall and in the next tick it will be behind the wall without ever triggering a collision. CCD ensures that collisions are still detected. By default it is deactivated (threshold = 0) which is fine for slow or static objects, but it should be set to a real value for fast moving objects (e.g. projectiles).
A good value for the threshold is (diameter^2).
ccdMotionThreshold | CCD is enabled if the squared velocity of the object is > ccdMotionThreshold (default 0.0). 0.0 means deactivated. |
|
inline |
Sets the radius of the sphere which is used for continuous collision detection (CCD).
The sphere should be embedded inside the objects collision shape, preferably smaller.
A good value for the radius is (diameter/5).
ccdSweptSphereRadius | The diameter of the sphere which is used for CCD (default 0.0). |
|
inline |
Enables or disables collision response (default is of course on)
void orxonox::WorldEntity::setCollisionType | ( | CollisionType | type | ) |
Sets the CollisionType.
This alters the object significantly!
void orxonox::WorldEntity::setCollisionTypeStr | ( | const std::string & | type | ) |
Sets the CollisionType by string (used for the XMLPort)
|
inline |
void orxonox::WorldEntity::setDirection | ( | const Vector3 & | direction, |
TransformSpace | relativeTo = TransformSpace::Local , |
||
const Vector3 & | localDirectionVector = Vector3::NEGATIVE_UNIT_Z |
||
) |
Makes this WorldEntity look in specific direction.
direction | A point relative to the position of the WorldEntity which defines its orientation |
relativeTo | The TransformSpace of this translation |
localDirectionVector | The vector which normally describes the natural direction of the object, usually -Z. |
|
inline |
|
inlineprivate |
|
inline |
Applies friction to the object. Friction occurs when two objects collide.
|
inline |
|
inline |
Applies a mass independent damping. Velocities will simply diminish exponentially.
|
inline |
Sets the mass of this object. Note that the total mass may be influenced by attached objects!
|
pure virtual |
Implemented in orxonox::ControllableEntity, orxonox::MobileEntity, orxonox::StaticEntity, and orxonox::MovableEntity.
|
inline |
|
inline |
|
inline |
|
pure virtual |
Implemented in orxonox::ControllableEntity, orxonox::MobileEntity, orxonox::StaticEntity, and orxonox::MovableEntity.
|
inline |
|
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)
|
inline |
|
virtual |
Sets the three dimensional scaling of this object.
|
inline |
void orxonox::WorldEntity::translate | ( | const Vector3 & | distance, |
TransformSpace | relativeTo = TransformSpace::Parent |
||
) |
Translates this WorldEntity by a vector.
distance | The relative distance of the translation |
relativeTo | The TransformSpace of this translation |
|
inline |
|
overridevirtual |
XML loading and saving.
xmlelement | The XML-element |
mode | The mode defines the operation that is being executed: loading or saving the object (from or to XML respectively) |
Reimplemented from orxonox::BaseObject.
Reimplemented in orxonox::LensFlare, orxonox::PongCenterpoint, orxonox::ModularSpaceShip, orxonox::MultiTrigger, orxonox::Actionpoint, orxonox::DistanceTrigger, orxonox::DistanceMultiTrigger, orxonox::SpaceShip, orxonox::SpaceBoundaries, orxonox::QuestEffectBeacon, orxonox::ForceField, orxonox::AsteroidMinable, orxonox::PickupSpawner, orxonox::FlappyOrxShip, orxonox::EventMultiTrigger, orxonox::TriggerBase, orxonox::Turret, orxonox::Dock, orxonox::PongBall, orxonox::PortalEndPoint, orxonox::WeaponSlot, orxonox::Pawn, orxonox::TetrisCenterpoint, orxonox::TowerDefenseField, orxonox::Model, orxonox::CheckPoint, orxonox::MobileEntity, orxonox::Light, orxonox::Planet, orxonox::ControllableEntity, orxonox::AutonomousDrone, orxonox::ScriptableControllerDrone, orxonox::Attacher, orxonox::TowerDefenseCenterpoint, orxonox::ExplosionPart, orxonox::Weapon, orxonox::Drone, orxonox::HoverOrigin, orxonox::OrxoKartOrigin, orxonox::SOBFireball, orxonox::SOBTube, orxonox::RaceCheckPoint, orxonox::JumpItem, orxonox::JumpEnemy, orxonox::JumpPlatform, orxonox::JumpPlatformTimer, orxonox::SOBFlagstone, orxonox::Billboard, orxonox::WorldSound, orxonox::Asteroids2DCenterPoint, orxonox::SOBCoin, orxonox::SOBGumba, orxonox::SOBItem, orxonox::SOBMushroom, orxonox::MovableEntity, orxonox::FpsPlayer, orxonox::JumpCenterpoint, orxonox::SOBCenterpoint, orxonox::FadingBillboard, orxonox::HoverShip, orxonox::OrxoKartKart, orxonox::PacmanGhost, orxonox::PacmanPointAfraid, orxonox::PacmanPointSphere, orxonox::AnimatedModel, orxonox::Backlight, orxonox::BlinkingBillboard, orxonox::NameableStaticEntity, orxonox::SpawnPoint, orxonox::ParticleEmitter, orxonox::ParticleSpawner, orxonox::TeamSpawnPoint, orxonox::SOBQBlock, orxonox::CameraPosition, orxonox::JumpFigure, orxonox::ShootableObstacle, orxonox::WagnisGameboard, and orxonox::WagnisProvince.
|
inline |
|
inlineprivate |
|
friend |
|
private |
|
private |
|
static |
|
private |
|
private |
|
private |
Tells whether the object should respond to collisions.
|
private |
|
private |
|
private |
When attaching objects hierarchically this variable tells this object (as child) whether physics was activated before attaching (because the deactivate physics while being attached).
|
private |
Network synchronised variable for bPhysicsActive_.
|
private |
|
private |
|
private |
|
private |
|
private |
Sum of all the children's masses.
|
private |
Attached collision shapes go here.
|
private |
|
private |
Network synchronised variable for collisionType_.
|
static |
|
private |
|
static |
|
protected |
Used by the ScriptableController to identify objects.
|
static |
|
private |
|
private |
|
private |
|
protected |
|
private |
|
private |
|
protected |
Bullet rigid body. Everything physical is applied to this instance.
|
private |
|
static |
|
static |