You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm reading through the collision filtering section of the documentation which mentions that collision filtering should be done via bit masks and the setCollisionCategoryBits and setCollideWithMaskBits functions.
I was curious to see the type that these functions use as their bit mask parameters, and I found:
// Set the collision bits mask/** * @param collideWithMaskBits The bits mask that specifies with which collision category this shape will collide*/voidCollider::setCollideWithMaskBits(unsignedshort collideWithMaskBits) {
mBody->mWorld.mCollidersComponents.setCollideWithMaskBits(mEntity, collideWithMaskBits);
int broadPhaseId = mBody->mWorld.mCollidersComponents.getBroadPhaseId(mEntity);
// Ask the broad-phase collision detection to test this collider next framemBody->mWorld.mCollisionDetection.askForBroadPhaseCollisionCheck(this);
RP3D_LOG(mBody->mWorld.mConfig.worldName, Logger::Level::Information, Logger::Category::Collider,
"Collider" + std::to_string(broadPhaseId) + ": Set collideWithMaskBits=" +
std::to_string(collideWithMaskBits), __FILE__, __LINE__);
}
So we're using an unsigned short to hold the bit mask, which means we are limited to 16 different categories.
Does anyone know if there is a way around this limitation? I can imagine a complex scenario in which more than 16 categories make sense. The allowance of only 16 categories seems pretty limiting to me.
If there is no way around this 16 bit limitation, could someone shine some light on the reason why we're using an unsigned short here instead of an unsigned int or, better yet, an unsigned long? If we really are doing a bitwise & operation to check if there is collision allowed, the size of the bit mask should have a negligible effect on performance.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm reading through the collision filtering section of the documentation which mentions that collision filtering should be done via bit masks and the
setCollisionCategoryBits
andsetCollideWithMaskBits
functions.I was curious to see the type that these functions use as their bit mask parameters, and I found:
So we're using an
unsigned short
to hold the bit mask, which means we are limited to 16 different categories.Does anyone know if there is a way around this limitation? I can imagine a complex scenario in which more than 16 categories make sense. The allowance of only 16 categories seems pretty limiting to me.
If there is no way around this 16 bit limitation, could someone shine some light on the reason why we're using an
unsigned short
here instead of anunsigned int
or, better yet, anunsigned long
? If we really are doing a bitwise&
operation to check if there is collision allowed, the size of the bit mask should have a negligible effect on performance.Thanks in advanced for reading through this 🤠
Beta Was this translation helpful? Give feedback.
All reactions