private bool IsPassThrought(CollidablePair pair) {
bepu.EventContactInit(pair.A.Handle, pair.B.Handle);
var a = bepu.GetHandleUnit(pair.A.Handle);
var b = bepu.GetHandleUnit(pair.B.Handle);
if (a == null|| b == null)
{
return true;
}
var isPassThroughA = bepu.GetHandleUnit(pair.A.Handle).Collider.isPassThrough;
if (isPassThroughA)
{
return false;
};
var isPassThroughB = bepu.GetHandleUnit(pair.B.Handle).Collider.isPassThrough;
if (isPassThroughB)
{
return false;
}
else
{
return true;
}
}
Sorry, I'm not sure exactly what you mean, so I'm going to make a best guess-
It sounds like you're trying to make a trigger object that doesn't collide with the character, so you made a collision filter for use in the narrow phase callbacks that avoids generating contact constraints if the body metadata is flagged as passthrough. Now, the character sometimes falls through the ground inappropriately.
If I understand that correctly, it may be because the collidable pair being passed to the function includes a static object. That function doesn't distinguish between statics and bodies, and it's possible for a static and body to have the same handle. So the GetHandleUnit fails to find the static-associated metadata (or finds the wrong metadata), causing it to fall through.
If that's the issue, then taking into account the CollidableReference.Mobility property will help. Bodies and statics have separate handle 'namespaces', so you should check if the mobility is Static before trying to use the associated handle.