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_DYNAMIC_OBJECT = 0,
131 CF_STATIC_OBJECT = 1,
132 CF_KINEMATIC_OBJECT = 2,
133 CF_NO_CONTACT_RESPONSE = 4,
134 CF_CUSTOM_MATERIAL_CALLBACK = 8,
135 CF_CHARACTER_OBJECT = 16,
136 CF_DISABLE_VISUALIZE_OBJECT = 32,
137 CF_DISABLE_SPU_COLLISION_PROCESSING = 64,
138 CF_HAS_CONTACT_STIFFNESS_DAMPING = 128,
139 CF_HAS_CUSTOM_DEBUG_RENDERING_COLOR = 256,
140 CF_HAS_FRICTION_ANCHOR = 512,
141 CF_HAS_COLLISION_SOUND_TRIGGER = 1024
146 CO_COLLISION_OBJECT = 1,
154 CO_FEATHERSTONE_LINK = 64
159 CF_ANISOTROPIC_FRICTION_DISABLED = 0,
160 CF_ANISOTROPIC_FRICTION = 1,
161 CF_ANISOTROPIC_ROLLING_FRICTION = 2
167 return ((m_collisionFlags & (CF_STATIC_OBJECT | CF_KINEMATIC_OBJECT | CF_NO_CONTACT_RESPONSE)) == 0);
172 return m_anisotropicFriction;
176 m_anisotropicFriction = anisotropicFriction;
177 bool isUnity = (anisotropicFriction[0] != 1.f) || (anisotropicFriction[1] != 1.f) || (anisotropicFriction[2] != 1.f);
178 m_hasAnisotropicFriction = isUnity ? frictionMode : 0;
182 return (m_hasAnisotropicFriction & frictionMode) != 0;
189 m_contactProcessingThreshold = contactProcessingThreshold;
193 return m_contactProcessingThreshold;
198 return (m_collisionFlags & CF_STATIC_OBJECT) != 0;
203 return (m_collisionFlags & CF_KINEMATIC_OBJECT) != 0;
208 return (m_collisionFlags & (CF_KINEMATIC_OBJECT | CF_STATIC_OBJECT)) != 0;
213 return (m_collisionFlags & CF_NO_CONTACT_RESPONSE) == 0;
223 m_collisionShape = collisionShape;
224 m_rootCollisionShape = collisionShape;
229 return m_collisionShape;
234 return m_collisionShape;
239 if (ignoreCollisionCheck)
245 m_objectsWithoutCollisionCheck.
push_back(co);
250 m_objectsWithoutCollisionCheck.
remove(co);
252 m_checkCollideWith = m_objectsWithoutCollisionCheck.
size() > 0;
257 return m_objectsWithoutCollisionCheck.
size();
262 return m_objectsWithoutCollisionCheck[index];
268 if (index < m_objectsWithoutCollisionCheck.
size())
279 return m_extensionPointer;
285 m_extensionPointer = pointer;
290 void setActivationState(
int newState)
const;
294 m_deactivationTime = time;
298 return m_deactivationTime;
301 void forceActivationState(
int newState)
const;
303 void activate(
bool forceActivation =
false)
const;
313 m_restitution = rest;
317 return m_restitution;
332 m_rollingFriction = frict;
336 return m_rollingFriction;
341 m_spinningFriction = frict;
345 return m_spinningFriction;
350 m_contactStiffness = stiffness;
351 m_contactDamping = damping;
353 m_collisionFlags |= CF_HAS_CONTACT_STIFFNESS_DAMPING;
364 return m_contactStiffness;
369 return m_contactDamping;
375 return m_internalType;
380 return m_worldTransform;
385 return m_worldTransform;
391 m_worldTransform = worldTrans;
396 return m_broadphaseHandle;
401 return m_broadphaseHandle;
406 m_broadphaseHandle = handle;
411 return m_interpolationWorldTransform;
416 return m_interpolationWorldTransform;
422 m_interpolationWorldTransform = trans;
428 m_interpolationLinearVelocity = linvel;
434 m_interpolationAngularVelocity = angvel;
439 return m_interpolationLinearVelocity;
444 return m_interpolationAngularVelocity;
459 return m_companionId;
469 return m_worldArrayIndex;
475 m_worldArrayIndex = ix;
480 return m_hitFraction;
485 m_hitFraction = hitFraction;
490 return m_collisionFlags;
495 m_collisionFlags = flags;
501 return m_ccdSweptSphereRadius;
507 m_ccdSweptSphereRadius = radius;
512 return m_ccdMotionThreshold;
517 return m_ccdMotionThreshold * m_ccdMotionThreshold;
523 m_ccdMotionThreshold = ccdMotionThreshold;
529 return m_userObjectPointer;
550 m_userObjectPointer = userPointer;
561 m_userIndex2 = index;
566 m_userIndex3 = index;
571 return m_updateRevision;
576 m_customDebugColorRGB = colorRGB;
577 m_collisionFlags |= CF_HAS_CUSTOM_DEBUG_RENDERING_COLOR;
582 m_collisionFlags &= ~CF_HAS_CUSTOM_DEBUG_RENDERING_COLOR;
587 bool hasCustomColor = (0 != (m_collisionFlags & CF_HAS_CUSTOM_DEBUG_RENDERING_COLOR));
590 colorRGB = m_customDebugColorRGB;
592 return hasCustomColor;
597 if (m_checkCollideWith)
598 return checkCollideWithOverride(co);
603 virtual int calculateSerializeBufferSize()
const;
606 virtual const char* serialize(
void* dataBuffer,
class btSerializer* serializer)
const;
608 virtual void serializeSingleObject(
class btSerializer * serializer)
const;
#define btCollisionObjectData
btAlignedObjectArray< class btCollisionObject * > btCollisionObjectArray
#define DISABLE_SIMULATION
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
#define ATTRIBUTE_ALIGNED16(a)
#define SIMD_FORCE_INLINE
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
int size() const
return the number of elements in the array
int findLinearSearch(const T &key) const
void remove(const T &key)
void push_back(const T &_Val)
btCollisionObject can be used to manage collision detection objects.
btScalar getContactStiffness() const
void setRestitution(btScalar rest)
int m_updateRevision
internal update revision number. It will be increased when the object changes. This allows some subsy...
virtual bool checkCollideWithOverride(const btCollisionObject *co) const
const btTransform & getInterpolationWorldTransform() const
void setSpinningFriction(btScalar frict)
bool isStaticOrKinematicObject() const
btScalar getHitFraction() const
void setAnisotropicFriction(const btVector3 &anisotropicFriction, int frictionMode=CF_ANISOTROPIC_FRICTION)
void setWorldArrayIndex(int ix)
void setCollisionFlags(int flags)
btTransform & getWorldTransform()
int m_checkCollideWith
If some object should have elaborate collision filtering by sub-classes.
void removeCustomDebugColor()
const btVector3 & getInterpolationAngularVelocity() const
btBroadphaseProxy * getBroadphaseHandle()
int getUserIndex3() const
const btVector3 & getInterpolationLinearVelocity() const
btTransform m_worldTransform
btCollisionShape * m_collisionShape
int getUserIndex2() const
void setUserPointer(void *userPointer)
users can point to their objects, userPointer is not used by Bullet
const btVector3 & getAnisotropicFriction() const
int getInternalType() const
reserved for Bullet internal usage
virtual void setCollisionShape(btCollisionShape *collisionShape)
btScalar getDeactivationTime() const
bool hasContactResponse() const
btVector3 m_interpolationLinearVelocity
void setIgnoreCollisionCheck(const btCollisionObject *co, bool ignoreCollisionCheck)
btScalar getSpinningFriction() const
const btBroadphaseProxy * getBroadphaseHandle() const
bool isStaticObject() const
void setContactProcessingThreshold(btScalar contactProcessingThreshold)
the constraint solver can discard solving contacts, if the distance is above this threshold.
btCollisionShape * m_rootCollisionShape
m_rootCollisionShape is temporarily used to store the original collision shape The m_collisionShape m...
void * m_extensionPointer
m_extensionPointer is used by some internal low-level Bullet extensions.
bool checkCollideWith(const btCollisionObject *co) const
btVector3 m_interpolationAngularVelocity
bool getCustomDebugColor(btVector3 &colorRGB) const
int m_internalType
m_internalType is reserved to distinguish Bullet's btCollisionObject, btRigidBody,...
void setWorldTransform(const btTransform &worldTrans)
void * m_userObjectPointer
users can point to their objects, m_userPointer is not used by Bullet, see setUserPointer/getUserPoin...
void setCustomDebugColor(const btVector3 &colorRGB)
btScalar getFriction() const
btVector3 m_anisotropicFriction
btScalar getContactProcessingThreshold() const
int getWorldArrayIndex() const
void setCcdMotionThreshold(btScalar ccdMotionThreshold)
Don't do continuous collision detection if the motion (in one step) is less then m_ccdMotionThreshold...
btScalar m_ccdSweptSphereRadius
Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
bool hasAnisotropicFriction(int frictionMode=CF_ANISOTROPIC_FRICTION) const
virtual int calculateSerializeBufferSize() const
const btTransform & getWorldTransform() const
btTransform m_interpolationWorldTransform
m_interpolationWorldTransform is used for CCD and interpolation it can be either previous or future (...
void setCompanionId(int id)
int getNumObjectsWithoutCollision() const
bool isKinematicObject() const
btScalar m_deactivationTime
btScalar getContactDamping() const
int getCompanionId() const
void setUserIndex2(int index)
void setFriction(btScalar frict)
void * getUserPointer() const
users can point to their objects, userPointer is not used by Bullet
void internalSetExtensionPointer(void *pointer)
Avoid using this internal API call, the extension pointer is used by some Bullet extensions If you ne...
btAlignedObjectArray< const btCollisionObject * > m_objectsWithoutCollisionCheck
void setCcdSweptSphereRadius(btScalar radius)
Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
void setContactStiffnessAndDamping(btScalar stiffness, btScalar damping)
void setDeactivationTime(btScalar time)
btCollisionShape * getCollisionShape()
bool mergesSimulationIslands() const
btScalar m_ccdMotionThreshold
Don't do continuous collision detection if the motion (in one step) is less then m_ccdMotionThreshold...
btScalar m_contactProcessingThreshold
void setRollingFriction(btScalar frict)
btScalar m_contactDamping
void setIslandTag(int tag)
void setBroadphaseHandle(btBroadphaseProxy *handle)
BT_DECLARE_ALIGNED_ALLOCATOR()
btScalar m_spinningFriction
btBroadphaseProxy * m_broadphaseHandle
const btCollisionObject * getObjectWithoutCollision(int index)
int m_hasAnisotropicFriction
int getCollisionFlags() const
void setInterpolationAngularVelocity(const btVector3 &angvel)
btScalar getCcdMotionThreshold() const
void setHitFraction(btScalar hitFraction)
btScalar m_rollingFriction
void * internalGetExtensionPointer() const
Avoid using this internal API call, the extension pointer is used by some Bullet extensions.
btVector3 m_customDebugColorRGB
void setInterpolationLinearVelocity(const btVector3 &linvel)
btTransform & getInterpolationWorldTransform()
btScalar m_hitFraction
time of impact calculation
int getUpdateRevisionInternal() const
void setUserIndex(int index)
users can point to their objects, userPointer is not used by Bullet
btScalar getRestitution() const
int getActivationState() const
btScalar getRollingFriction() const
btScalar getCcdSquareMotionThreshold() const
void setInterpolationWorldTransform(const btTransform &trans)
btScalar m_contactStiffness
const btCollisionShape * getCollisionShape() const
void setUserIndex3(int index)
btScalar getCcdSweptSphereRadius() const
Swept sphere radius (0.0 by default), see btConvexConvexAlgorithm::
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
btVector3 can be used to represent 3D points and vectors.
The btBroadphaseProxy is the main class that can be used with the Bullet broadphases.
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btVector3DoubleData m_anisotropicFriction
btVector3DoubleData m_interpolationLinearVelocity
int m_collisionFilterMask
double m_deactivationTime
double m_contactProcessingThreshold
int m_hasAnisotropicFriction
double m_ccdSweptSphereRadius
btTransformDoubleData m_interpolationWorldTransform
int m_collisionFilterGroup
btTransformDoubleData m_worldTransform
void * m_broadphaseHandle
double m_contactStiffness
btVector3DoubleData m_interpolationAngularVelocity
btCollisionShapeData * m_rootCollisionShape
double m_ccdMotionThreshold
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
btVector3FloatData m_interpolationLinearVelocity
float m_ccdSweptSphereRadius
btVector3FloatData m_anisotropicFriction
float m_contactProcessingThreshold
int m_collisionFilterMask
btTransformFloatData m_interpolationWorldTransform
float m_ccdMotionThreshold
btVector3FloatData m_interpolationAngularVelocity
btTransformFloatData m_worldTransform
int m_collisionFilterGroup
int m_hasAnisotropicFriction
btCollisionShapeData * m_rootCollisionShape
void * m_broadphaseHandle
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64