Pickup ability raycast goes through walls

Vlaxep

Active member
Hi,

I have a pickup that is hidden behind a sliding compartment door.

The player has to find a key to be able to open the door obstructing access to the pickup weapon.

The issue is that the pickup raycast goes through the door. I can't figure out why the Raycast is able to see straight through the door layer.

My pickup ability layer mask uses the layer 'pickup', and the door is on 'default' layer. If I add 'default' to the pickup layerMask then even without the door blocking the pickup, the raycast then won't detect the pickup.

I feel like there's got to be some other setting I'm not using correctly but can't nail this down. I need to be able to block the raycast with the door, and be able to pickup the weapon/item once the door has stopped obstructing it.

Thanks
 
Ah ok, think I figured it out - user error.

I did have another collider interfering on the default layer, causing no detection even when the door is moved away.

So is is correct then, that if I want to use Raycast detection for a pickup, I need to include all physics layers in the detection layerMask?So far that appears right
 
Top