Public Member Functions | Protected Attributes | Private Attributes

btCompoundShape Class Reference

The btCompoundShape allows to store multiple other btCollisionShapes This allows for moving concave collision objects. More...

#include <btCompoundShape.h>

Inheritance diagram for btCompoundShape:
Inheritance graph
[legend]
Collaboration diagram for btCompoundShape:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 BT_DECLARE_ALIGNED_ALLOCATOR ()
 btCompoundShape (bool enableDynamicAabbTree=true)
virtual ~btCompoundShape ()
void addChildShape (const btTransform &localTransform, btCollisionShape *shape)
virtual void removeChildShape (btCollisionShape *shape)
 Remove all children shapes that contain the specified shape.
void removeChildShapeByIndex (int childShapeindex)
int getNumChildShapes () const
btCollisionShapegetChildShape (int index)
const btCollisionShapegetChildShape (int index) const
btTransformgetChildTransform (int index)
const btTransformgetChildTransform (int index) const
void updateChildTransform (int childIndex, const btTransform &newChildTransform, bool shouldRecalculateLocalAabb=true)
 set a new transform for a child, and update internal data structures (local aabb and dynamic tree)
btCompoundShapeChildgetChildList ()
virtual void getAabb (const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
 getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
virtual void recalculateLocalAabb ()
 Re-calculate the local Aabb.
virtual void setLocalScaling (const btVector3 &scaling)
virtual const btVector3getLocalScaling () const
virtual void calculateLocalInertia (btScalar mass, btVector3 &inertia) const
virtual void setMargin (btScalar margin)
virtual btScalar getMargin () const
virtual const char * getName () const
const btDbvtgetDynamicAabbTree () const
btDbvtgetDynamicAabbTree ()
void createAabbTreeFromChildren ()
void calculatePrincipalAxisTransform (btScalar *masses, btTransform &principal, btVector3 &inertia) const
 computes the exact moment of inertia and the transform from the coordinate system defined by the principal axes of the moment of inertia and the center of mass to the current coordinate system.
int getUpdateRevision () const
virtual int calculateSerializeBufferSize () const
virtual const char * serialize (void *dataBuffer, btSerializer *serializer) const
 fills the dataBuffer and returns the struct name (and 0 on failure)

Protected Attributes

btVector3 m_localScaling

Private Attributes

btAlignedObjectArray
< btCompoundShapeChild
m_children
btVector3 m_localAabbMin
btVector3 m_localAabbMax
btDbvtm_dynamicAabbTree
int m_updateRevision
 increment m_updateRevision when adding/removing/replacing child shapes, so that some caches can be updated
btScalar m_collisionMargin

Detailed Description

The btCompoundShape allows to store multiple other btCollisionShapes This allows for moving concave collision objects.

This is more general then the static concave btBvhTriangleMeshShape. It has an (optional) dynamic aabb tree to accelerate early rejection tests.

Definition at line 54 of file btCompoundShape.h.


Constructor & Destructor Documentation

btCompoundShape::btCompoundShape ( bool  enableDynamicAabbTree = true  ) 

Definition at line 21 of file btCompoundShape.cpp.

btCompoundShape::~btCompoundShape (  )  [virtual]

Definition at line 40 of file btCompoundShape.cpp.


Member Function Documentation

void btCompoundShape::addChildShape ( const btTransform localTransform,
btCollisionShape shape 
)

Definition at line 49 of file btCompoundShape.cpp.

btCompoundShape::BT_DECLARE_ALIGNED_ALLOCATOR (  ) 

Reimplemented from btCollisionShape.

void btCompoundShape::calculateLocalInertia ( btScalar  mass,
btVector3 inertia 
) const [virtual]

Implements btCollisionShape.

Definition at line 191 of file btCompoundShape.cpp.

void btCompoundShape::calculatePrincipalAxisTransform ( btScalar masses,
btTransform principal,
btVector3 inertia 
) const

computes the exact moment of inertia and the transform from the coordinate system defined by the principal axes of the moment of inertia and the center of mass to the current coordinate system.

"masses" points to an array of masses of the children. The resulting transform "principal" has to be applied inversely to all children transforms in order for the local coordinate system of the compound shape to be centered at the center of mass and to coincide with the principal axes. This also necessitates a correction of the world transform of the collision object by the principal transform.

Definition at line 214 of file btCompoundShape.cpp.

int btCompoundShape::calculateSerializeBufferSize (  )  const [inline, virtual]

Reimplemented from btCollisionShape.

Definition at line 201 of file btCompoundShape.h.

void btCompoundShape::createAabbTreeFromChildren (  ) 

Definition at line 296 of file btCompoundShape.cpp.

void btCompoundShape::getAabb ( const btTransform t,
btVector3 aabbMin,
btVector3 aabbMax 
) const [virtual]

getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version

Implements btCollisionShape.

Definition at line 167 of file btCompoundShape.cpp.

btCompoundShapeChild* btCompoundShape::getChildList (  )  [inline]

Definition at line 112 of file btCompoundShape.h.

btCollisionShape* btCompoundShape::getChildShape ( int  index  )  [inline]

Definition at line 90 of file btCompoundShape.h.

const btCollisionShape* btCompoundShape::getChildShape ( int  index  )  const [inline]

Definition at line 94 of file btCompoundShape.h.

btTransform& btCompoundShape::getChildTransform ( int  index  )  [inline]

Definition at line 99 of file btCompoundShape.h.

const btTransform& btCompoundShape::getChildTransform ( int  index  )  const [inline]

Definition at line 103 of file btCompoundShape.h.

const btDbvt* btCompoundShape::getDynamicAabbTree (  )  const [inline]

Definition at line 146 of file btCompoundShape.h.

btDbvt* btCompoundShape::getDynamicAabbTree (  )  [inline]

Definition at line 151 of file btCompoundShape.h.

virtual const btVector3& btCompoundShape::getLocalScaling (  )  const [inline, virtual]

Implements btCollisionShape.

Definition at line 126 of file btCompoundShape.h.

virtual btScalar btCompoundShape::getMargin (  )  const [inline, virtual]

Implements btCollisionShape.

Definition at line 137 of file btCompoundShape.h.

virtual const char* btCompoundShape::getName (  )  const [inline, virtual]

Implements btCollisionShape.

Definition at line 141 of file btCompoundShape.h.

int btCompoundShape::getNumChildShapes (  )  const [inline]

Definition at line 85 of file btCompoundShape.h.

int btCompoundShape::getUpdateRevision (  )  const [inline]

Definition at line 165 of file btCompoundShape.h.

void btCompoundShape::recalculateLocalAabb (  )  [virtual]

Re-calculate the local Aabb.

Is called at the end of removeChildShapes. Use this yourself if you modify the children or their transforms.

Definition at line 143 of file btCompoundShape.cpp.

void btCompoundShape::removeChildShape ( btCollisionShape shape  )  [virtual]

Remove all children shapes that contain the specified shape.

Definition at line 125 of file btCompoundShape.cpp.

void btCompoundShape::removeChildShapeByIndex ( int  childShapeindex  ) 

Definition at line 108 of file btCompoundShape.cpp.

const char * btCompoundShape::serialize ( void *  dataBuffer,
btSerializer serializer 
) const [virtual]

fills the dataBuffer and returns the struct name (and 0 on failure)

Reimplemented from btCollisionShape.

Definition at line 320 of file btCompoundShape.cpp.

void btCompoundShape::setLocalScaling ( const btVector3 scaling  )  [virtual]

Implements btCollisionShape.

Definition at line 276 of file btCompoundShape.cpp.

virtual void btCompoundShape::setMargin ( btScalar  margin  )  [inline, virtual]

Implements btCollisionShape.

Definition at line 133 of file btCompoundShape.h.

void btCompoundShape::updateChildTransform ( int  childIndex,
const btTransform newChildTransform,
bool  shouldRecalculateLocalAabb = true 
)

set a new transform for a child, and update internal data structures (local aabb and dynamic tree)

update the dynamic aabb tree

Definition at line 88 of file btCompoundShape.cpp.


Member Data Documentation

Definition at line 56 of file btCompoundShape.h.

Definition at line 65 of file btCompoundShape.h.

Definition at line 60 of file btCompoundShape.h.

Definition at line 58 of file btCompoundShape.h.

Definition at line 57 of file btCompoundShape.h.

Definition at line 68 of file btCompoundShape.h.

increment m_updateRevision when adding/removing/replacing child shapes, so that some caches can be updated

Definition at line 63 of file btCompoundShape.h.


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