CollisionFilter confusion!

var filter = new CollisionFilter { BelongsTo = (uint)Layer.Actor, CollidesWith = (1u << Layer.Actor), GroupIndex = 0 };

Layer.Actor is an integer of 2.

My template for actors is set up like this:
8150708--1058792--upload_2022-5-23_21-8-26.png

So why is it raycasting is always failing against the actor? In Physx the above always works. Perhaps I’m just confused by the obvious or don’t understand how DOTS Physics is thinking.

8150708--1058792--upload_2022-5-23_21-8-26.png

https://docs.unity3d.com/Packages/com.unity.physics@0.50/manual/collision_queries.html#filtering

Has the exact formula for filtering

BelongsTo = (uint)Layer.Actor

Pretty sure that’s your issue, think it should also be 1 << Layer.Actor

1 Like

Duh.gif! I honestly wonder sometimes as I’d read that several times but then for some reason dismissed it - probably it was the template wrong. Coming back to it, works fine! Thanks for clearing it up.