ArticulatedPhysicsEntity Class Reference

#include <ArticulatedPhysicsEntity.h>

Inherits PhysicsEntity.

Collaboration diagram for ArticulatedPhysicsEntity:

List of all members.


Public Member Functions

 ArticulatedPhysicsEntity (unsigned short id, unsigned short environmentId, unsigned short instanceId, EntityType *type)
virtual ~ArticulatedPhysicsEntity ()
virtual void addForceAtPosition (gmtl::Vec3f &force, gmtl::Vec3f &position, bool relativeForce=false, bool relativePosition=false)
virtual void getRigidBodies (std::vector< oops::RigidBody * > &rigidBodyList)
virtual void getJoints (std::vector< oops::Joint * > &jointList)
virtual PhysicsObjectID getPhysicsObjectID ()
virtual void setEnvironment (Environment *env)

Static Public Attributes

static const unsigned ARTICULATEDPHYSICSENTITY_CLASSID = 2
 unique class-ID used for PhysicsObjectID

Protected Member Functions

virtual void setArticulatedBody (oops::ArticulatedBody *obj)
virtual bool initialize ()
virtual void setRigidBodyMapping (unsigned rigidBodyIndex, unsigned succeedingEntityIndex)

Protected Attributes

bool isInitialized
 Indicating if the physical representation is already initialized.
bool addedToSimulation
 Indicating if Entity is added to physics simulation.
oops::ArticulatedBodyarticulatedBody
 Pointer to the physical representation of the Entity.
std::map< unsigned, unsigned > rigidBodyMapping
 Mapping from RigidBody-index to SimplePhysicsEntity-ID-offset.
PhysicsObjectID physicsObjectID
 ID of the PhysicsObject.

Friends

class ArticulatedPhysicsEntityController
class ArticulatedPhysicsEntityType
class CursorSpringConnector

Detailed Description

Entity with ArticulatedBody as physical representation. This class can be used for Entities which can be represented by an ArticulatedBody.

Constructor & Destructor Documentation

ArticulatedPhysicsEntity::ArticulatedPhysicsEntity ( unsigned short  id,
unsigned short  environmentId,
unsigned short  instanceId,
EntityType type 
)

Constructor initializes Entity.

Parameters:
id ID of the Entity
environmentId ID of the Environment where the Entity is created
instanceId ID for the instance this Entity is from the EntityType
type EntityType this Entity is an instance of

ArticulatedPhysicsEntity::~ArticulatedPhysicsEntity (  )  [virtual]

Destructor removes Object from Physics Module.


Member Function Documentation

void ArticulatedPhysicsEntity::addForceAtPosition ( gmtl::Vec3f &  force,
gmtl::Vec3f &  position,
bool  relativeForce = false,
bool  relativePosition = false 
) [virtual]

Adds a force at a passed position at the Physics Server. The method encodes the method call into a message and passes it to the PhysicsObjectManager which sends it to the Physics Server which simulates this Entity.

Parameters:
force force to add
position where to add the force
relativeForce is the force oriented relative to the body
relativePosition is the position relative to the body

virtual void ArticulatedPhysicsEntity::getJoints ( std::vector< oops::Joint * > &  jointList  )  [virtual]

Fills the passed list with all Joints it contains. It is mainly used by the PhysicsObjectManager to add the Joints to the simulation.

Parameters:
jointList List which is filled with contained Joints

Implements PhysicsEntity.

PhysicsObjectID ArticulatedPhysicsEntity::getPhysicsObjectID (  )  [virtual]

Adds the PhysicsObject to the passed simulation instance.

Parameters:
simulation oops::Simulation class instance
Returns:
true if the object could be added, false otherwise Removes the PhysicsObject from the passed simulation instance.
Parameters:
simulation oops::Simulation class instance
Returns:
true if the object could be removed, false otherwise Returns the ID of the PhysicsObject. The method has to return the unique PhysicsObjectID of the PhysicsObject. The programmer has to ensure that this PhysicsObjectID is set properly and that it is unique.

ID of the PhysicsObject

Implements PhysicsEntity.

virtual void ArticulatedPhysicsEntity::getRigidBodies ( std::vector< oops::RigidBody * > &  rigidBodyList  )  [virtual]

Fills the passed list with all RigidBodies it contains. It is mainly used by the PhysicsObjectManager to add the RigidBodies to the simulation.

Parameters:
rigidBodyList List which is filled with contained RigidBodies

Implements PhysicsEntity.

bool ArticulatedPhysicsEntity::initialize (  )  [protected, virtual]

Sets the initial Transformation of the ArticulatedBody. The method sets the TransformationPipe of the ArticulatedBody. It does so by taking the Transformation of the ArticulatedPhysicsEntity in world coordinates and multiplying the inverse offset transformation stored in the ArticulatedBody.

Returns:
true if the ArticulatedBody-Transformation could be set

void ArticulatedPhysicsEntity::setArticulatedBody ( oops::ArticulatedBody obj  )  [protected, virtual]

Adds the passed force at the passed position to the Physics Entity. This method is the server part of the addForceAtPosition method. It is only called on the machine which acts as Server for this PhysicsEntity.

Parameters:
force force to add
position where to add the force
relativeForce is the force oriented relative to the body
relativePosition is the position relative to the body Sets the ArticulatedBody. The method sets the ArticulatedBody to the PhysicsEntity. It is called by the ArticulatedPhysicsEntityType-class in the createInstance method.
obj ArticulatedBody representing the ArticulatedPhysicsEntity

void ArticulatedPhysicsEntity::setEnvironment ( Environment env  )  [virtual]

Sets the Environment the Entity belongs to. It is called by the Environment-class and initially sets the pointer to the Environment the Entity is created in. The method is not intended to be used when the Environment is changed, therefore call the changeEnvironment method.

Parameters:
env Environment the Entity belongs to

Reimplemented from Entity.

void ArticulatedPhysicsEntity::setRigidBodyMapping ( unsigned  rigidBodyIndex,
unsigned  succeedingEntityIndex 
) [protected, virtual]

Sets the mapping of the RigidBodies inside the ArticulatedBody to the Entities in the world. The method sets the mapping of a RigidBody inside the ArticulatedBody to an Entity. Each ArticulatedBody consists of a number of RigidBodies. These RigidBodies have to be represented by SimplePhysicsEntities yet. In the Environment config file the ArticulatedPhysicsEntity has to be followed by a number of SimplePhysicsEntities each for one RigidBody inside the ArticulatedBody. The passed indices define the index of the RigidBody inside the ArticulatedBody and the ID-offset of the matching SimplePhysicsEntity to the ArticulatedPhysicsEntity.

Parameters:
rigidBodyIndex Index of the RigidBody inside the ArticulatedBody
succeedingEntityIndex ID-offset between the ArticulatedPhysicsEntity and the SimplePhysicsEntity


Friends And Related Function Documentation

friend class ArticulatedPhysicsEntityController [friend]

friend class ArticulatedPhysicsEntityType [friend]

friend class CursorSpringConnector [friend]

Handles incoming messages containing remote method calls. The method receives an incoming message containing a remote method call. First it decodes the type of the message. If the type is not a negative number it is not handled by the PhysicsEntity-class itself and therfore the message is passed to the handleMessage(unsigned type,OSG::NetMessage* msg) method which has to be implemented in the derived class. If the method-type is a negative number it is proven which method call is encoded by comparing the type with the REMOTE_FUNCTIONS enumeration member. If a matching function is found it is called.

Parameters:
msg Message containing remote method call.
Returns:
true if the method call could be executed.

Reimplemented from PhysicsEntity.


Member Data Documentation

Indicating if Entity is added to physics simulation.

Pointer to the physical representation of the Entity.

unique class-ID used for PhysicsObjectID

Indicating if the physical representation is already initialized.

ID of the PhysicsObject.

std::map<unsigned, unsigned> ArticulatedPhysicsEntity::rigidBodyMapping [protected]

Mapping from RigidBody-index to SimplePhysicsEntity-ID-offset.


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

Generated on Wed Oct 20 16:11:53 2010 for inVRs by doxygen 1.5.8