SimplePhysicsEntity Class Reference

#include <SimplePhysicsEntity.h>

Inherits PhysicsEntity.

Collaboration diagram for SimplePhysicsEntity:

List of all members.


Public Member Functions

 SimplePhysicsEntity (unsigned short id, unsigned short environmentId, unsigned short instanceId, EntityType *type)
virtual ~SimplePhysicsEntity ()
virtual void addForce (gmtl::Vec3f &force, bool relative=false)
virtual oops::RigidBodygetRigidBody ()
virtual void getRigidBodies (std::vector< oops::RigidBody * > &rigidBodyList)
virtual void getJoints (std::vector< oops::Joint * > &jointList)
virtual PhysicsObjectID getPhysicsObjectID ()
virtual void setEnvironment (Environment *env)
virtual void setWorldTransformation (TransformationData trans)

Static Public Attributes

static const unsigned SIMPLEPHYSICSENTITY_CLASSID = 1

Protected Member Functions

virtual void setRigidBody (oops::RigidBody *obj, bool useBodyTransformation=false)
virtual bool calculatePhysicsTransformation ()

Protected Attributes

bool addedToSimulation
 Function calls which have to be distributed to server.
bool rigidBodyInitialized
 Indicating if the RigidBody is already initialized with the Entity-transformation.
oops::RigidBodyrigidBody
 Pointer to the physical representation of the Entity.
PhysicsObjectID physicsObjectID
 ID of the PhysicsObject.

Friends

class SimplePhysicsEntityController
class SimplePhysicsEntityType
class ArticulatedPhysicsEntity
class CursorSpringConnector

Detailed Description

Entity with single RigidBody as physical representation. This class can be used for Entities which can be represented by one single RigidBody.

Constructor & Destructor Documentation

SimplePhysicsEntity::SimplePhysicsEntity ( 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

SimplePhysicsEntity::~SimplePhysicsEntity (  )  [virtual]

Destructor removes Object from Physics Module.


Member Function Documentation

void SimplePhysicsEntity::addForce ( gmtl::Vec3f &  force,
bool  relative = false 
) [virtual]

Adds a force to the RigidBody. The method just calls the addForce-method on the contained RigidBody. The distribution from this input to other hosts is done by the SynchronisationModel which has a Listener on such method calls.

Parameters:
force Force that should be added
relative indicating if force is relative to RigidBody

bool SimplePhysicsEntity::calculatePhysicsTransformation (  )  [protected, virtual]

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

Returns:
true if the RigidBody-Transformation could be set

virtual void SimplePhysicsEntity::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 SimplePhysicsEntity::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 SimplePhysicsEntity::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.

oops::RigidBody * SimplePhysicsEntity::getRigidBody (  )  [virtual]

Returns the RigidBody used by the Entity

Returns:
RigidBody of the Entity

void SimplePhysicsEntity::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 SimplePhysicsEntity::setRigidBody ( oops::RigidBody obj,
bool  useBodyTransformation = false 
) [protected, virtual]

Sets the RigidBody. The method sets the RigidBody to the PhysicsEntity. It is called by the SimplePhysicsEntityType-class in the createInstance method.

Parameters:
obj RigidBody representing the SimplePhysicsEntity
useBodyTransformation define if RigidBody transformation should be applied to Entity

void SimplePhysicsEntity::setWorldTransformation ( TransformationData  trans  )  [virtual]

Sets the Transformation of the Entity in World-coordinates!!! It also calls the update-method to write the new Entity-Transformation to the SceneGraph.

Parameters:
trans the Transformation of the Entity in World-coordinates

Reimplemented from Entity.


Friends And Related Function Documentation

friend class ArticulatedPhysicsEntity [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.

friend class SimplePhysicsEntityController [friend]

friend class SimplePhysicsEntityType [friend]


Member Data Documentation

Function calls which have to be distributed to server.

Adds force to RigidBody on server side. This method is the server side of the addForce method. It adds the force to the RigidBody.

Parameters:
force force to add to RigidBody
relative indicates if force is relative to RigidBody indicating if the object is already added to the simulation

ID of the PhysicsObject.

Pointer to the physical representation of the Entity.

Indicating if the RigidBody is already initialized with the Entity-transformation.


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

Generated on Wed Oct 20 16:12:00 2010 for inVRs by doxygen 1.5.8