ContactFilter2D & SetNormalAngle() with Collider2D.Cast()

I’m performing a Collider2D.Cast() passing a ContactFilter2D parameter.

No matter what values I use in SetNormalAngle() when first initializing the ContactFilter2D, the returned RaycastHit2D does not filter any points. Is this intended? As a side note the layer mask is filtering points correctly.

//Scan for points under collider
ContactFilter2D filter = new ContactFilter2D();
filter.SetNormalAngle(MinGroundAngle, MaxGroundAngle);
GroundPointsCount = Collider.Cast(DirectionOfGravity, filter, GroundPoints, GroundScanDistance, true);

Also, how is the normal angle of a hit calculated? Is this angle relative to the cast direction?

Thanks for any answers,

I’ve been trying to figure out what I’ve been doing wrong with my own code, and I’ve noticed that no matter what numbers I set with SetNormalAngle, either it filters nothing or everything, depending on whether or not I have useOutsideNormalAngle set to true.

It definitely did not work like this a bit ago as I had some code that was working perfectly fine up until I updated, and now my collision detections that checked if I was hitting from only directly below thanks to normal angle filtering will now return true no matter what direction I hit from, or alternatively never return true no matter the angle.

I’m pretty sure it got broken in one of the patches… unless the functionality changed in some way that I need to address in my code to fix.

Maybe you are missing filter.useNormalAngle?