I have some invisible walls that I only want the player model to interact with but they also block raycasts, how can I get them to stop blocking raycasts?,I have some invisible walls that I want to only interact with the player model but I don’t want them to block raycasts, how can I do this?
@aiden_unity18
Physics.Raycast has a parameter named layerMask. It will help you to eliminate the layer on which you do not want raycast.
// Bit shift the index of the layer (8) to get a bit mask
int layerMask = 1 << 8;
// This would cast rays only against colliders in layer 8.
// But instead we want to collide against everything except layer 8. The ~ operator does this, it inverts a bitmask.
layerMask = ~layerMask;