Bullet Collision Detection & Physics Library: btGhostObject Class Reference

Bullet Collision Detection & Physics Library

Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
btGhostObject Class Reference

The btGhostObject can keep track of all objects that are overlapping By default, this overlap is based on the AABB This is useful for creating a character controller, collision sensors/triggers, explosions etc. More...

`#include <btGhostObject.h>`

Inheritance diagram for btGhostObject:
[legend]
Collaboration diagram for btGhostObject:
[legend]

## Public Member Functions
| btGhostObject ()
virtual | ~btGhostObject ()
void | convexSweepTest (const class btConvexShape *castShape, const btTransform &convexFromWorld, const btTransform &convexToWorld, btCollisionWorld::ConvexResultCallback &resultCallback, btScalar allowedCcdPenetration=0.f) const
void | rayTest (const btVector3 &rayFromWorld, const btVector3 &rayToWorld, btCollisionWorld::RayResultCallback &resultCallback) const
virtual void | addOverlappingObjectInternal (btBroadphaseProxy *otherProxy, btBroadphaseProxy *thisProxy=0)
| this method is mainly for expert/internal use only.
virtual void | removeOverlappingObjectInternal (btBroadphaseProxy *otherProxy, btDispatcher *dispatcher, btBroadphaseProxy *thisProxy=0)
| this method is mainly for expert/internal use only.
int | getNumOverlappingObjects () const
btCollisionObject * | getOverlappingObject (int index)
const btCollisionObject * | getOverlappingObject (int index) const
btAlignedObjectArray< btCollisionObject * > & | getOverlappingPairs ()
const btAlignedObjectArray< btCollisionObject * > | getOverlappingPairs () const
Public Member Functions inherited from btCollisionObject
| BT_DECLARE_ALIGNED_ALLOCATOR ()
bool | mergesSimulationIslands () const
const btVector3 & | getAnisotropicFriction () const
void | setAnisotropicFriction (const btVector3 &anisotropicFriction, int frictionMode=CF_ANISOTROPIC_FRICTION)
bool | hasAnisotropicFriction (int frictionMode=CF_ANISOTROPIC_FRICTION) const
void | setContactProcessingThreshold (btScalar contactProcessingThreshold)
| the constraint solver can discard solving contacts, if the distance is above this threshold.
btScalar | getContactProcessingThreshold () const
bool | isStaticObject () const
bool | isKinematicObject () const
bool | isStaticOrKinematicObject () const
bool | hasContactResponse () const
| btCollisionObject ()
virtual | ~btCollisionObject ()
virtual void | setCollisionShape (btCollisionShape *collisionShape)
const btCollisionShape * | getCollisionShape () const
btCollisionShape * | getCollisionShape ()
void | setIgnoreCollisionCheck (const btCollisionObject *co, bool ignoreCollisionCheck)
int | getNumObjectsWithoutCollision () const
const btCollisionObject * | getObjectWithoutCollision (int index)
virtual bool | checkCollideWithOverride (const btCollisionObject *co) const
void * | internalGetExtensionPointer () const
| Avoid using this internal API call, the extension pointer is used by some Bullet extensions.
void | internalSetExtensionPointer (void *pointer)
| Avoid using this internal API call, the extension pointer is used by some Bullet extensions If you need to store your own user pointer, use 'setUserPointer/getUserPointer' instead.
int | getActivationState () const
void | setActivationState (int newState) const
void | setDeactivationTime (btScalar time)
btScalar | getDeactivationTime () const
void | forceActivationState (int newState) const
void | activate (bool forceActivation=false) const
bool | isActive () const
void | setRestitution (btScalar rest)
btScalar | getRestitution () const
void | setFriction (btScalar frict)
btScalar | getFriction () const
void | setRollingFriction (btScalar frict)
btScalar | getRollingFriction () const
void | setSpinningFriction (btScalar frict)
btScalar | getSpinningFriction () const
void | setContactStiffnessAndDamping (btScalar stiffness, btScalar damping)
btScalar | getContactStiffness () const
btScalar | getContactDamping () const
int | getInternalType () const
| reserved for Bullet internal usage
btTransform & | getWorldTransform ()
const btTransform & | getWorldTransform () const
void | setWorldTransform (const btTransform &worldTrans)
btBroadphaseProxy * | getBroadphaseHandle ()
const btBroadphaseProxy * | getBroadphaseHandle () const
void | setBroadphaseHandle (btBroadphaseProxy *handle)
const btTransform & | getInterpolationWorldTransform () const
btTransform & | getInterpolationWorldTransform ()
void | setInterpolationWorldTransform (const btTransform &trans)
void | setInterpolationLinearVelocity (const btVector3 &linvel)
void | setInterpolationAngularVelocity (const btVector3 &angvel)
const btVector3 & | getInterpolationLinearVelocity () const
const btVector3 & | getInterpolationAngularVelocity () const
int | getIslandTag () const
void | setIslandTag (int tag)
int | getCompanionId () const
void | setCompanionId (int id)
int | getWorldArrayIndex () const
void | setWorldArrayIndex (int ix)
btScalar | getHitFraction () const
void | setHitFraction (btScalar hitFraction)
int | getCollisionFlags () const
void | setCollisionFlags (int flags)
btScalar | getCcdSweptSphereRadius () const
| Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
void | setCcdSweptSphereRadius (btScalar radius)
| Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
btScalar | getCcdMotionThreshold () const
btScalar | getCcdSquareMotionThreshold () const
void | setCcdMotionThreshold (btScalar ccdMotionThreshold)
| Don't do continuous collision detection if the motion (in one step) is less then m_ccdMotionThreshold.
void * | getUserPointer () const
| users can point to their objects, userPointer is not used by Bullet
int | getUserIndex () const
int | getUserIndex2 () const
int | getUserIndex3 () const
void | setUserPointer (void *userPointer)
| users can point to their objects, userPointer is not used by Bullet
void | setUserIndex (int index)
| users can point to their objects, userPointer is not used by Bullet
void | setUserIndex2 (int index)
void | setUserIndex3 (int index)
int | getUpdateRevisionInternal () const
void | setCustomDebugColor (const btVector3 &colorRGB)
void | removeCustomDebugColor ()
bool | getCustomDebugColor (btVector3 &colorRGB) const
bool | checkCollideWith (const btCollisionObject *co) const
virtual int | calculateSerializeBufferSize () const
virtual const char * | serialize (void *dataBuffer, class btSerializer *serializer) const
| fills the dataBuffer and returns the struct name (and 0 on failure)
virtual void | serializeSingleObject (class btSerializer *serializer) const

## Static Public Member Functions
static const btGhostObject * | upcast (const btCollisionObject *colObj)
static btGhostObject * | upcast (btCollisionObject *colObj)

## Protected Attributes
btAlignedObjectArray< btCollisionObject * > | m_overlappingObjects
Protected Attributes inherited from btCollisionObject
btTransform | m_worldTransform
btTransform | m_interpolationWorldTransform
| m_interpolationWorldTransform is used for CCD and interpolation it can be either previous or future (predicted) transform
btVector3 | m_interpolationLinearVelocity
btVector3 | m_interpolationAngularVelocity
btVector3 | m_anisotropicFriction
int | m_hasAnisotropicFriction
btScalar | m_contactProcessingThreshold
btBroadphaseProxy * | m_broadphaseHandle
btCollisionShape * | m_collisionShape
void * | m_extensionPointer
| m_extensionPointer is used by some internal low-level Bullet extensions.
btCollisionShape * | m_rootCollisionShape
| m_rootCollisionShape is temporarily used to store the original collision shape The m_collisionShape might be temporarily replaced by a child collision shape during collision detection purposes If it is NULL, the m_collisionShape is not temporarily replaced.
int | m_collisionFlags
int | m_islandTag1
int | m_companionId
int | m_worldArrayIndex
int | m_activationState1
btScalar | m_deactivationTime
btScalar | m_friction
btScalar | m_restitution
btScalar | m_rollingFriction
btScalar | m_spinningFriction
btScalar | m_contactDamping
btScalar | m_contactStiffness
int | m_internalType
| m_internalType is reserved to distinguish Bullet's btCollisionObject, btRigidBody, btSoftBody, btGhostObject etc.
void * | m_userObjectPointer
| users can point to their objects, m_userPointer is not used by Bullet, see setUserPointer/getUserPointer
int | m_userIndex2
int | m_userIndex
int | m_userIndex3
btScalar | m_hitFraction
| time of impact calculation
btScalar | m_ccdSweptSphereRadius
| Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
btScalar | m_ccdMotionThreshold
| Don't do continuous collision detection if the motion (in one step) is less then m_ccdMotionThreshold.
int | m_checkCollideWith
| If some object should have elaborate collision filtering by sub-classes.
btAlignedObjectArray< const btCollisionObject * > | m_objectsWithoutCollisionCheck
int | m_updateRevision
| internal update revision number. It will be increased when the object changes. This allows some subsystems to perform lazy evaluation.
btVector3 | m_customDebugColorRGB

## Additional Inherited Members
Public Types inherited from btCollisionObject
enum | CollisionFlags { CF_DYNAMIC_OBJECT = 0 , CF_STATIC_OBJECT = 1 , CF_KINEMATIC_OBJECT = 2 , CF_NO_CONTACT_RESPONSE = 4 , CF_CUSTOM_MATERIAL_CALLBACK = 8 , CF_CHARACTER_OBJECT = 16 , CF_DISABLE_VISUALIZE_OBJECT = 32 , CF_DISABLE_SPU_COLLISION_PROCESSING = 64 , CF_HAS_CONTACT_STIFFNESS_DAMPING = 128 , CF_HAS_CUSTOM_DEBUG_RENDERING_COLOR = 256 , CF_HAS_FRICTION_ANCHOR = 512 , CF_HAS_COLLISION_SOUND_TRIGGER = 1024 }
enum | CollisionObjectTypes { CO_COLLISION_OBJECT = 1 , CO_RIGID_BODY = 2 , CO_GHOST_OBJECT = 4 , CO_SOFT_BODY = 8 , CO_HF_FLUID = 16 , CO_USER_TYPE = 32 , CO_FEATHERSTONE_LINK = 64 }
enum | AnisotropicFrictionFlags { CF_ANISOTROPIC_FRICTION_DISABLED = 0 , CF_ANISOTROPIC_FRICTION = 1 , CF_ANISOTROPIC_ROLLING_FRICTION = 2 }

## Detailed Description

The btGhostObject can keep track of all objects that are overlapping By default, this overlap is based on the AABB This is useful for creating a character controller, collision sensors/triggers, explosions etc.

We plan on adding rayTest and other queries for the btGhostObject

Definition at line 33 of file btGhostObject.h.

## Constructor & Destructor Documentation

## ◆ btGhostObject()

btGhostObject::btGhostObject | ( |  | ) |

Definition at line 21 of file btGhostObject.cpp.

## ◆ ~btGhostObject()

btGhostObject::~btGhostObject | ( |  | ) |
| virtual

btGhostObject should have been removed from the world, so no overlapping objects

Definition at line 26 of file btGhostObject.cpp.

## Member Function Documentation

## ◆ addOverlappingObjectInternal()

void btGhostObject::addOverlappingObjectInternal | ( | btBroadphaseProxy * | otherProxy,
|  | btBroadphaseProxy * | thisProxy = 0 )
| virtual

this method is mainly for expert/internal use only.

if this linearSearch becomes too slow (too many overlapping objects) we should add a more appropriate data structure

Reimplemented in btPairCachingGhostObject.

Definition at line 32 of file btGhostObject.cpp.

## ◆ convexSweepTest()

void btGhostObject::convexSweepTest | ( | const class btConvexShape * | castShape,
|  | const btTransform & | convexFromWorld,
|  | const btTransform & | convexToWorld,
|  | btCollisionWorld::ConvexResultCallback & | resultCallback,
|  | btScalar | allowedCcdPenetration = 0.f ) const

go over all objects, and if the ray intersects their aabb + cast shape aabb,

Definition at line 99 of file btGhostObject.cpp.

## ◆ getNumOverlappingObjects()

int btGhostObject::getNumOverlappingObjects | ( |  | ) | const
| inline

Definition at line 53 of file btGhostObject.h.

## ◆ getOverlappingObject() [1/2]

btCollisionObject * btGhostObject::getOverlappingObject | ( | int | index | ) |
| inline

Definition at line 58 of file btGhostObject.h.

## ◆ getOverlappingObject() [2/2]

const btCollisionObject * btGhostObject::getOverlappingObject | ( | int | index | ) | const
| inline

Definition at line 63 of file btGhostObject.h.

## ◆ getOverlappingPairs() [1/2]

btAlignedObjectArray< btCollisionObject * > & btGhostObject::getOverlappingPairs | ( |  | ) |
| inline

Definition at line 68 of file btGhostObject.h.

## ◆ getOverlappingPairs() [2/2]

const btAlignedObjectArray< btCollisionObject * > btGhostObject::getOverlappingPairs | ( |  | ) | const
| inline

Definition at line 73 of file btGhostObject.h.

## ◆ rayTest()

void btGhostObject::rayTest | ( | const btVector3 & | rayFromWorld,
|  | const btVector3 & | rayToWorld,
|  | btCollisionWorld::RayResultCallback & | resultCallback ) const

Definition at line 143 of file btGhostObject.cpp.

## ◆ removeOverlappingObjectInternal()

void btGhostObject::removeOverlappingObjectInternal | ( | btBroadphaseProxy * | otherProxy,
|  | btDispatcher * | dispatcher,
|  | btBroadphaseProxy * | thisProxy = 0 )
| virtual

this method is mainly for expert/internal use only.

Reimplemented in btPairCachingGhostObject.

Definition at line 45 of file btGhostObject.cpp.

## ◆ upcast() [1/2]

btGhostObject * btGhostObject::upcast | ( | btCollisionObject * | colObj | ) |
| inlinestatic

Definition at line 88 of file btGhostObject.h.

## ◆ upcast() [2/2]

const btGhostObject * btGhostObject::upcast | ( | const btCollisionObject * | colObj | ) |
| inlinestatic

Definition at line 82 of file btGhostObject.h.

## Member Data Documentation

## ◆ m_overlappingObjects

btAlignedObjectArray<btCollisionObject*> btGhostObject::m_overlappingObjects
| protected

Definition at line 37 of file btGhostObject.h.

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

- btGhostObject.h
- btGhostObject.cpp