Skip to content

Shape filters and compound shapes #473

Answered by jrouwe
mihe asked this question in Q&A
Mar 14, 2023 · 2 comments · 8 replies
Discussion options

You must be logged in to vote

Hello,

There's indeed a problem here. We call ShouldCollide at every level in the hierarchy, so for a compound with a box you'll get 2 callbacks. The problem is that you currently cannot determine if you're at the compound stage or at the box stage. The SubShape ID is basically a string of bits where at each level some bits are pushed in from the right. The compound shape has 2 shapes, meaning it uses 1 bit.

  • First you get a call comparing the compound shape, this is the root so you get 0xffffffff (empty)
  • Then you get a call comparing the box shape, this is the first sub shape so the last bit of the sub shape ID is 0: 0xfffffffe (box/sphere shapes don't have any bits because they're a sin…

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
2 replies
@mihe
Comment options

@DocAce
Comment options

Comment options

You must be logged in to vote
6 replies
@mihe
Comment options

@jrouwe
Comment options

@mihe
Comment options

@jrouwe
Comment options

@mihe
Comment options

Answer selected by mihe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants