I'm using BulletUnity (which is build upon BulletSharp - Bullet wrapper for C#).
Here every RigidBody has 3 properties:
Code: Select all
BulletSharp.CollisionFlags collisionFlags
BulletSharp.CollisionFilterGroups collisionGroupsIBelongTo
BulletSharp.CollisionFilterGroups collisionMask
(the only exclusion I met is TerrainCollisionObject, which has same props, but each of them could contain only 1 flag, but I suppose, it's not proper realization).
I tried to figure out, what every of these 3 props means.
If I've understand correct:
- `collisionGroups` & `collisionMask` are used in broadPhase to weed out pairs, which should not collide (logically - e.g. arrow with grass)
`collisionGroups` describes our object, while `collisionMask` describes "which other objects our one should collide" (logically) - I suppose, `collisionFlags` describes our object for narrow phase, but I couldn't find code, where it is used for this purpose.
- Am I right in my understanding of what `collisionGroups` & `collisionMask` are & how they used?
- What is `collisionFlags` & how it poperty is used basically & in connection with other 2 props?
For example, why we need "static" and "kinematic" flags among CollisionFlags enum, if we already have same-named options among CollisionFilterGroups enum, which we could set in `collisionGroups` for our object?
PS:
here are corresponding enums (to perhaps save your time to find them in bullet code):
Code: Select all
enum CollisionFlags
{
CF_STATIC_OBJECT= 1,
CF_KINEMATIC_OBJECT= 2,
CF_NO_CONTACT_RESPONSE = 4,
CF_CUSTOM_MATERIAL_CALLBACK = 8,//this allows per-triangle material (friction/restitution)
CF_CHARACTER_OBJECT = 16,
CF_DISABLE_VISUALIZE_OBJECT = 32, //disable debug drawing
CF_DISABLE_SPU_COLLISION_PROCESSING = 64,//disable parallel/SPU processing
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 CollisionFilterGroups
{
DefaultFilter = 1,
StaticFilter = 2,
KinematicFilter = 4,
DebrisFilter = 8,
SensorTrigger = 16,
CharacterFilter = 32,
AllFilter = -1 //all bits sets: DefaultFilter | StaticFilter | KinematicFilter | DebrisFilter | SensorTrigger
};