Currently it is in preview. See newsletter: PlayCanvas Engine v1.62 RC - Updates to Shader Chunks and WebGPU and forum post https://forum.playcanvas.com/t/engine-release-v1-62
- Tag all the entities you want to ignore.
- RaycastAll to get all the results that intersect with the raycast.
- (Potentially optional) Sort results by intersection point distance from the camera.
- Loop through the results and use the first result that doesn’t have the tag.