Physics Simulation Forum


All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Collision Flags & Groups
PostPosted: Tue Sep 05, 2017 10:50 am 

Joined: Fri Aug 04, 2017 10:38 am
Posts: 2
I'm a little confused in CollisionFlags & CollisionFilterGroups
I'm using BulletUnity (which is build upon BulletSharp - Bullet wrapper for C#).

Here every RigidBody has 3 properties:
   BulletSharp.CollisionFlags collisionFlags
   BulletSharp.CollisionFilterGroups collisionGroupsIBelongTo
   BulletSharp.CollisionFilterGroups collisionMask

Each one could contain multiple flags on
(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.

So, my questions are:
  1. Am I right in my understanding of what `collisionGroups` & `collisionMask` are & how they used?
  2. 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?

Thank for your help!

here are corresponding enums (to perhaps save your time to find them in bullet code):

   enum CollisionFlags
      CF_CUSTOM_MATERIAL_CALLBACK = 8,//this allows per-triangle material (friction/restitution)
      CF_DISABLE_VISUALIZE_OBJECT = 32, //disable debug drawing
      CF_DISABLE_SPU_COLLISION_PROCESSING = 64,//disable parallel/SPU processing

   enum CollisionFilterGroups
      DefaultFilter = 1,
      StaticFilter = 2,
      KinematicFilter = 4,
      DebrisFilter = 8,
      SensorTrigger = 16,
      CharacterFilter = 32,
      AllFilter = -1 //all bits sets: DefaultFilter | StaticFilter | KinematicFilter | DebrisFilter | SensorTrigger

PostPosted: Tue Sep 05, 2017 11:57 am 
User avatar

Joined: Tue Sep 30, 2014 6:03 pm
Posts: 363
Location: San Francisco
Your understanding of collisionGroups & collisionMask is correct.

The collisionFlags bits are used as boolean indicators to enable/disable various per-object behaviors. The "collision" part of the name is a bit of a misnomer: objectFlags might have been more correct.

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: Baidu [Spider], Majestic-12 [Bot] and 20 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group