>>> a = BitMask32.bit(20)
0000 0000 0001 0000 0000 0000 0000 0000
>>> b = BitMask32.bit(19)
0000 0000 0000 1000 0000 0000 0000 0000
>>> a & b
0000 0000 0000 0000 0000 0000 0000 0000
In words, BitMask32.bit(20) creates a bitmask with the twenty-first bit set to 1, and BitMask32.bit(19) creates a bitmask with the twentieth bit set to 1.
Because they don’t have overlapping bits, they do not interact in any way - as you can see by (a & b) which returns zero.
Only collision objects that have overlapping on-bits in the appropriate mask will collide with each other.
If ObjA was a from object (bit 20), and where to collide with ObjK, into object (bit 16), according to your above statement, a collison would not happen
(unless it’s different depending on rather or not a object is Into or From; that was not visualize in my opening post).
What I want to know is, would P3D test for collision between two objects that will not collide because of different bit settings, or would the Engine ignore the possibility altogehter, overlooking needless work?
I know everything inserted into the Trav will be a From object (and a possible Into) and everything else outside the Trav is considered an Into.
That’s why I’m wondering if the engine would still perform the collison checking and then say later, “Hey, the bits aren’t right, so there’s no collision here.” or would P3D say, “Hey, the bits aren’t right here, so I’m not even going to bother with testing.”
or maybe it’s the testing that ultimately determines the outcome, therefore, even if the bits were different between two collision objects and they would not collide, the testing must still happen.
or is the testing for bits some kind of lower level testing and if the collision will happen, a full scale test is performed?
If you’re reading this rdb, I imagine you’re probably saying, “WTF” right about now.
Just my mind wondering into engine logic again, even though engine programming is not my thing.
However, the better you understand an Engine, the better you can use it.
Yes, the whole point of the bitmasks is to early-out the needless test between objects that are not intended to collide. Using bitmasks in this way correctly can save considerable time in the collision computation.