Bullet Collision Detection & Physics Library
|
Go to the documentation of this file.
16 #ifndef BT_COLLISION_OBJECT_H
17 #define BT_COLLISION_OBJECT_H
23 #define ISLAND_SLEEPING 2
24 #define WANTS_DEACTIVATION 3
25 #define DISABLE_DEACTIVATION 4
26 #define DISABLE_SIMULATION 5
37 #ifdef BT_USE_DOUBLE_PRECISION
38 #define btCollisionObjectData btCollisionObjectDoubleData
39 #define btCollisionObjectDataName "btCollisionObjectDoubleData"
41 #define btCollisionObjectData btCollisionObjectFloatData
42 #define btCollisionObjectDataName "btCollisionObjectFloatData"
130 CF_STATIC_OBJECT = 1,
131 CF_KINEMATIC_OBJECT = 2,
132 CF_NO_CONTACT_RESPONSE = 4,
133 CF_CUSTOM_MATERIAL_CALLBACK = 8,
134 CF_CHARACTER_OBJECT = 16,
135 CF_DISABLE_VISUALIZE_OBJECT = 32,
136 CF_DISABLE_SPU_COLLISION_PROCESSING = 64,
137 CF_HAS_CONTACT_STIFFNESS_DAMPING = 128,
138 CF_HAS_CUSTOM_DEBUG_RENDERING_COLOR = 256,
139 CF_HAS_FRICTION_ANCHOR = 512,
140 CF_HAS_COLLISION_SOUND_TRIGGER = 1024
145 CO_COLLISION_OBJECT = 1,
153 CO_FEATHERSTONE_LINK = 64
158 CF_ANISOTROPIC_FRICTION_DISABLED = 0,
159 CF_ANISOTROPIC_FRICTION = 1,
160 CF_ANISOTROPIC_ROLLING_FRICTION = 2
166 return ((m_collisionFlags & (CF_STATIC_OBJECT | CF_KINEMATIC_OBJECT | CF_NO_CONTACT_RESPONSE)) == 0);
171 return m_anisotropicFriction;
175 m_anisotropicFriction = anisotropicFriction;
176 bool isUnity = (anisotropicFriction[0] != 1.f) || (anisotropicFriction[1] != 1.f) || (anisotropicFriction[2] != 1.f);
177 m_hasAnisotropicFriction = isUnity ? frictionMode : 0;
181 return (m_hasAnisotropicFriction & frictionMode) != 0;
188 m_contactProcessingThreshold = contactProcessingThreshold;
192 return m_contactProcessingThreshold;
197 return (m_collisionFlags & CF_STATIC_OBJECT) != 0;
202 return (m_collisionFlags & CF_KINEMATIC_OBJECT) != 0;
207 return (m_collisionFlags & (CF_KINEMATIC_OBJECT | CF_STATIC_OBJECT)) != 0;
212 return (m_collisionFlags & CF_NO_CONTACT_RESPONSE) == 0;
222 m_collisionShape = collisionShape;
223 m_rootCollisionShape = collisionShape;
228 return m_collisionShape;
233 return m_collisionShape;
238 if (ignoreCollisionCheck)
244 m_objectsWithoutCollisionCheck.
push_back(co);
249 m_objectsWithoutCollisionCheck.
remove(co);
251 m_checkCollideWith = m_objectsWithoutCollisionCheck.
size() > 0;
257 if (index < m_objectsWithoutCollisionCheck.
size())
268 return m_extensionPointer;
274 m_extensionPointer = pointer;
279 void setActivationState(
int newState)
const;
283 m_deactivationTime = time;
287 return m_deactivationTime;
290 void forceActivationState(
int newState)
const;
292 void activate(
bool forceActivation =
false)
const;
302 m_restitution = rest;
306 return m_restitution;
321 m_rollingFriction = frict;
325 return m_rollingFriction;
330 m_spinningFriction = frict;
334 return m_spinningFriction;
339 m_contactStiffness = stiffness;
340 m_contactDamping = damping;
342 m_collisionFlags |= CF_HAS_CONTACT_STIFFNESS_DAMPING;
353 return m_contactStiffness;
358 return m_contactDamping;
364 return m_internalType;
369 return m_worldTransform;
374 return m_worldTransform;
380 m_worldTransform = worldTrans;
385 return m_broadphaseHandle;
390 return m_broadphaseHandle;
395 m_broadphaseHandle = handle;
400 return m_interpolationWorldTransform;
405 return m_interpolationWorldTransform;
411 m_interpolationWorldTransform = trans;
417 m_interpolationLinearVelocity = linvel;
423 m_interpolationAngularVelocity = angvel;
428 return m_interpolationLinearVelocity;
433 return m_interpolationAngularVelocity;
448 return m_companionId;
458 return m_worldArrayIndex;
464 m_worldArrayIndex = ix;
469 return m_hitFraction;
474 m_hitFraction = hitFraction;
479 return m_collisionFlags;
484 m_collisionFlags = flags;
490 return m_ccdSweptSphereRadius;
496 m_ccdSweptSphereRadius = radius;
501 return m_ccdMotionThreshold;
506 return m_ccdMotionThreshold * m_ccdMotionThreshold;
512 m_ccdMotionThreshold = ccdMotionThreshold;
518 return m_userObjectPointer;
539 m_userObjectPointer = userPointer;
550 m_userIndex2 = index;
555 m_userIndex3 = index;
560 return m_updateRevision;
565 m_customDebugColorRGB = colorRGB;
566 m_collisionFlags |= CF_HAS_CUSTOM_DEBUG_RENDERING_COLOR;
571 m_collisionFlags &= ~CF_HAS_CUSTOM_DEBUG_RENDERING_COLOR;
576 bool hasCustomColor = (0 != (m_collisionFlags & CF_HAS_CUSTOM_DEBUG_RENDERING_COLOR));
579 colorRGB = m_customDebugColorRGB;
581 return hasCustomColor;
586 if (m_checkCollideWith)
587 return checkCollideWithOverride(co);
592 virtual int calculateSerializeBufferSize()
const;
595 virtual const char* serialize(
void* dataBuffer,
class btSerializer* serializer)
const;
597 virtual void serializeSingleObject(
class btSerializer * serializer)
const;
678 #endif //BT_COLLISION_OBJECT_H
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
virtual bool checkCollideWithOverride(const btCollisionObject *co) const
btCollisionObject can be used to manage collision detection objects.
#define DISABLE_SIMULATION
int m_collisionFilterMask
btScalar getContactDamping() const
The btBroadphaseProxy is the main class that can be used with the Bullet broadphases.
int getUserIndex2() const
double m_ccdMotionThreshold
int getUpdateRevisionInternal() const
btScalar m_ccdSweptSphereRadius
Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
btTransform m_interpolationWorldTransform
m_interpolationWorldTransform is used for CCD and interpolation it can be either previous or future (...
void setContactStiffnessAndDamping(btScalar stiffness, btScalar damping)
const btBroadphaseProxy * getBroadphaseHandle() const
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
int m_collisionFilterGroup
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
void setCcdMotionThreshold(btScalar ccdMotionThreshold)
Don't do continuous collision detection if the motion (in one step) is less then m_ccdMotionThreshold...
btAlignedObjectArray< const btCollisionObject * > m_objectsWithoutCollisionCheck
bool mergesSimulationIslands() const
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
void setWorldArrayIndex(int ix)
void * m_broadphaseHandle
btScalar m_ccdMotionThreshold
Don't do continuous collision detection if the motion (in one step) is less then m_ccdMotionThreshold...
int findLinearSearch(const T &key) const
void removeCustomDebugColor()
btTransformFloatData m_interpolationWorldTransform
#define btCollisionObjectData
int getActivationState() const
btTransform m_worldTransform
btTransformDoubleData m_interpolationWorldTransform
void setCustomDebugColor(const btVector3 &colorRGB)
btTransformDoubleData m_worldTransform
btScalar getContactStiffness() const
btScalar m_hitFraction
time of impact calculation
const btTransform & getWorldTransform() const
void setHitFraction(btScalar hitFraction)
btCollisionShapeData * m_rootCollisionShape
bool isKinematicObject() const
btScalar m_contactDamping
btVector3DoubleData m_interpolationLinearVelocity
const btVector3 & getInterpolationLinearVelocity() const
btScalar m_deactivationTime
int m_collisionFilterMask
float m_ccdMotionThreshold
btScalar m_spinningFriction
bool isStaticOrKinematicObject() const
double m_deactivationTime
int m_internalType
m_internalType is reserved to distinguish Bullet's btCollisionObject, btRigidBody,...
void * m_broadphaseHandle
void setIgnoreCollisionCheck(const btCollisionObject *co, bool ignoreCollisionCheck)
int m_hasAnisotropicFriction
btTransform & getWorldTransform()
bool checkCollideWith(const btCollisionObject *co) const
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
void setRestitution(btScalar rest)
btCollisionShape * m_collisionShape
void setUserIndex3(int index)
btScalar getCcdSquareMotionThreshold() const
void setCcdSweptSphereRadius(btScalar radius)
Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
virtual void setCollisionShape(btCollisionShape *collisionShape)
btVector3 m_anisotropicFriction
btCollisionShape * m_rootCollisionShape
m_rootCollisionShape is temporarily used to store the original collision shape The m_collisionShape m...
void setSpinningFriction(btScalar frict)
void setUserIndex(int index)
users can point to their objects, userPointer is not used by Bullet
btScalar getDeactivationTime() const
btTransformFloatData m_worldTransform
const btVector3 & getAnisotropicFriction() const
btVector3 m_customDebugColorRGB
btVector3FloatData m_interpolationAngularVelocity
btBroadphaseProxy * getBroadphaseHandle()
void setFriction(btScalar frict)
const btTransform & getInterpolationWorldTransform() const
void setWorldTransform(const btTransform &worldTrans)
btScalar getRollingFriction() const
int getUserIndex3() const
virtual int calculateSerializeBufferSize() const
void setCompanionId(int id)
int getCollisionFlags() const
void setDeactivationTime(btScalar time)
btVector3FloatData m_anisotropicFriction
bool isStaticObject() const
void setInterpolationAngularVelocity(const btVector3 &angvel)
void setInterpolationWorldTransform(const btTransform &trans)
#define BT_DECLARE_ALIGNED_ALLOCATOR()
btScalar getRestitution() const
btTransform & getInterpolationWorldTransform()
btVector3 can be used to represent 3D points and vectors.
btScalar getContactProcessingThreshold() const
btScalar m_rollingFriction
void setAnisotropicFriction(const btVector3 &anisotropicFriction, int frictionMode=CF_ANISOTROPIC_FRICTION)
bool hasContactResponse() const
void * m_extensionPointer
m_extensionPointer is used by some internal low-level Bullet extensions.
void setUserPointer(void *userPointer)
users can point to their objects, userPointer is not used by Bullet
btAlignedObjectArray< class btCollisionObject * > btCollisionObjectArray
btScalar getCcdMotionThreshold() const
btScalar m_contactProcessingThreshold
double m_contactProcessingThreshold
int getWorldArrayIndex() const
#define ATTRIBUTE_ALIGNED16(a)
btVector3 m_interpolationAngularVelocity
int m_updateRevision
internal update revision number. It will be increased when the object changes. This allows some subsy...
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
void * internalGetExtensionPointer() const
Avoid using this internal API call, the extension pointer is used by some Bullet extensions.
float m_contactProcessingThreshold
double m_ccdSweptSphereRadius
double m_contactStiffness
void setRollingFriction(btScalar frict)
#define SIMD_FORCE_INLINE
btCollisionShape * getCollisionShape()
void internalSetExtensionPointer(void *pointer)
Avoid using this internal API call, the extension pointer is used by some Bullet extensions If you ne...
void setBroadphaseHandle(btBroadphaseProxy *handle)
int m_hasAnisotropicFriction
void setCollisionFlags(int flags)
void setInterpolationLinearVelocity(const btVector3 &linvel)
btScalar getHitFraction() const
btScalar getSpinningFriction() const
int getInternalType() const
reserved for Bullet internal usage
btBroadphaseProxy * m_broadphaseHandle
void setIslandTag(int tag)
btVector3DoubleData m_interpolationAngularVelocity
int m_checkCollideWith
If some object should have elaborate collision filtering by sub-classes.
int m_hasAnisotropicFriction
bool getCustomDebugColor(btVector3 &colorRGB) const
btScalar getCcdSweptSphereRadius() const
Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
void setContactProcessingThreshold(btScalar contactProcessingThreshold)
the constraint solver can discard solving contacts, if the distance is above this threshold.
btScalar m_contactStiffness
bool hasAnisotropicFriction(int frictionMode=CF_ANISOTROPIC_FRICTION) const
void * m_userObjectPointer
users can point to their objects, m_userPointer is not used by Bullet, see setUserPointer/getUserPoin...
btVector3DoubleData m_anisotropicFriction
void push_back(const T &_Val)
btCollisionShapeData * m_rootCollisionShape
void remove(const T &key)
btVector3FloatData m_interpolationLinearVelocity
btScalar getFriction() const
float m_ccdSweptSphereRadius
btVector3 m_interpolationLinearVelocity
void * getUserPointer() const
users can point to their objects, userPointer is not used by Bullet
int m_collisionFilterGroup
void setUserIndex2(int index)
int size() const
return the number of elements in the array
const btVector3 & getInterpolationAngularVelocity() const
const btCollisionShape * getCollisionShape() const
int getCompanionId() const