Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

PhysicsBody::ComponentListener Class Reference

This object subscribes to a LinkComponent (usually the root KinematicJoint of a chain) and creates a corresponding PhysicsBodies for it and its children. More...

#include <PhysicsBody.h>

Inheritance diagram for PhysicsBody::ComponentListener:

Detailed Description

This object subscribes to a LinkComponent (usually the root KinematicJoint of a chain) and creates a corresponding PhysicsBodies for it and its children.

When parameters change in the KinematicJoint, the ComponentListener will update fields in the PhysicsBody. This may require rebuilding the chain of inter-body constraints.

Definition at line 28 of file PhysicsBody.h.

List of all members.

Public Member Functions

 ComponentListener (PhysicsWorld &world_, LinkComponent &comp_, plist::DictionaryOf< plist::Primitive< float > > &positions_, const plist::Point *location, const plist::Point *orientation)
 constructor, pass the physics world, source component, a dictionary of actuator positions (from which this joint's target position will be monitored), and the initial location */
 ~ComponentListener ()
 destructor
std::string getPath () const
 returns a string identifying the component within a chain
std::string getModel () const
 returns the name of the graphics model in use
PhysicsBodygetBody () const
 returns the PhysicsBody if available, otherwise NULL
PhysicsBodyfindBody ()
 returns the body this link is part of; either body or the first parent who has a non-NULL body (if it hits the root, a body is created!)

Protected Member Functions

 ComponentListener (PhysicsWorld &world_, LinkComponent &comp_, plist::DictionaryOf< plist::Primitive< float > > &positions_, ComponentListener *parent_)
 constructor for children attached to this link
void init ()
 does the setup and initialization
void allocBody ()
 allocates body (to be called if the link has mass and shape, or its children do.
void freeBody ()
 frees body
ComponentListenerfindLinkRoot ()
 returns the ComponentListener for the KinematicJoint; either *this, or the parent.
void rebuildBody ()
 called when the body has significantly changed and must rebuild its parameters
void updateListeners ()
 reinitialize individual field listeners, and those of its subcomponents
virtual void plistCollectionEntryAdded (plist::Collection &col, plist::ObjectBase &entry)
 This will be called whenever an entry is added to the collection.
virtual void plistCollectionEntryRemoved (plist::Collection &col, plist::ObjectBase &entry)
 This will be called whenever an entry is added to the collection.
virtual void plistCollectionEntriesChanged (plist::Collection &col)
 This will be called whenever an entry is replaced, or multiple entries are added/removed at once, such as when an assignment occurs.
virtual void kinematicJointBranchAdded (KinematicJoint &parent, KinematicJoint &branch)
virtual void kinematicJointBranchRemoved (KinematicJoint &parent, KinematicJoint &branch)
virtual void kinematicJointReconfigured (KinematicJoint &joint)
void updateMass ()
void updateModel ()

Static Protected Member Functions

static bool hasCollisionShape (const LinkComponent &c)

Protected Attributes

PhysicsWorldworld
LinkComponentcomp
plist::DictionaryOf
< plist::Primitive< float > > & 
positions
ComponentListenerparent
std::map< LinkComponent
*, ComponentListener * > 
subComps
const plist::PointbodyLocation
const plist::PointbodyOrientation
PhysicsBodybody
plist::CollectionCallbackMember
< PhysicsBody > * 
centerOfMassListener
plist::CollectionCallbackMember
< PhysicsBody > * 
collisionModelScaleListener
plist::CollectionCallbackMember
< PhysicsBody > * 
collisionModelRotationListener
plist::CollectionCallbackMember
< PhysicsBody > * 
collisionModelOffsetListener
plist::PrimitiveCallbackMember
< PhysicsBody::ComponentListener
massListener
plist::PrimitiveCallbackMember
< PhysicsBody::ComponentListener
collisionModelListener

Constructor & Destructor Documentation

PhysicsBody::ComponentListener::ComponentListener ( PhysicsWorld world_,
LinkComponent comp_,
plist::DictionaryOf< plist::Primitive< float > > &  positions_,
const plist::Point location,
const plist::Point orientation 
)

constructor, pass the physics world, source component, a dictionary of actuator positions (from which this joint's target position will be monitored), and the initial location */

Definition at line 31 of file PhysicsBody.h.

PhysicsBody::ComponentListener::~ComponentListener (  ) 

destructor

PhysicsBody::ComponentListener::ComponentListener ( PhysicsWorld world_,
LinkComponent comp_,
plist::DictionaryOf< plist::Primitive< float > > &  positions_,
ComponentListener parent_ 
) [protected]

constructor for children attached to this link

Definition at line 50 of file PhysicsBody.h.


Member Function Documentation

void PhysicsBody::ComponentListener::allocBody (  )  [protected]

allocates body (to be called if the link has mass and shape, or its children do.

PhysicsBody& PhysicsBody::ComponentListener::findBody (  ) 

returns the body this link is part of; either body or the first parent who has a non-NULL body (if it hits the root, a body is created!)

Referenced by rebuildBody().

ComponentListener& PhysicsBody::ComponentListener::findLinkRoot (  )  [protected]

returns the ComponentListener for the KinematicJoint; either *this, or the parent.

void PhysicsBody::ComponentListener::freeBody (  )  [protected]

frees body

PhysicsBody* PhysicsBody::ComponentListener::getBody (  )  const

returns the PhysicsBody if available, otherwise NULL

Definition at line 45 of file PhysicsBody.h.

std::string PhysicsBody::ComponentListener::getModel (  )  const

returns the name of the graphics model in use

Definition at line 43 of file PhysicsBody.h.

std::string PhysicsBody::ComponentListener::getPath (  )  const

returns a string identifying the component within a chain

static bool PhysicsBody::ComponentListener::hasCollisionShape ( const LinkComponent c  )  [static, protected]
void PhysicsBody::ComponentListener::init (  )  [protected]

does the setup and initialization

Referenced by ComponentListener().

virtual void PhysicsBody::ComponentListener::kinematicJointBranchAdded ( KinematicJoint parent,
KinematicJoint branch 
) [protected, virtual]

Reimplemented from KinematicJoint::BranchListener.

virtual void PhysicsBody::ComponentListener::kinematicJointBranchRemoved ( KinematicJoint parent,
KinematicJoint branch 
) [protected, virtual]

Reimplemented from KinematicJoint::BranchListener.

virtual void PhysicsBody::ComponentListener::kinematicJointReconfigured ( KinematicJoint joint  )  [protected, virtual]

Reimplemented from KinematicJoint::BranchListener.

virtual void PhysicsBody::ComponentListener::plistCollectionEntriesChanged ( plist::Collection  )  [protected, virtual]

This will be called whenever an entry is replaced, or multiple entries are added/removed at once, such as when an assignment occurs.

Reimplemented from plist::CollectionListener.

virtual void PhysicsBody::ComponentListener::plistCollectionEntryAdded ( plist::Collection ,
plist::ObjectBase  
) [protected, virtual]

This will be called whenever an entry is added to the collection.

Reimplemented from plist::CollectionListener.

virtual void PhysicsBody::ComponentListener::plistCollectionEntryRemoved ( plist::Collection ,
plist::ObjectBase  
) [protected, virtual]

This will be called whenever an entry is added to the collection.

Reimplemented from plist::CollectionListener.

void PhysicsBody::ComponentListener::rebuildBody (  )  [protected]

called when the body has significantly changed and must rebuild its parameters

Definition at line 63 of file PhysicsBody.h.

void PhysicsBody::ComponentListener::updateListeners (  )  [protected]

reinitialize individual field listeners, and those of its subcomponents

void PhysicsBody::ComponentListener::updateMass (  )  [protected]
void PhysicsBody::ComponentListener::updateModel (  )  [protected]

Member Data Documentation

Definition at line 86 of file PhysicsBody.h.

Referenced by getBody().

Definition at line 84 of file PhysicsBody.h.

Definition at line 85 of file PhysicsBody.h.

Definition at line 79 of file PhysicsBody.h.

Referenced by getModel().

Definition at line 82 of file PhysicsBody.h.

Definition at line 78 of file PhysicsBody.h.


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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:14 2016 by Doxygen 1.6.3