Raycasting layers / invisible objects

Is it possible to:
a) define raycasting layers
b) to raycast against objects that are not visible (act as dummies)?

I have done some digging and a workaround for a) may be marking objects are pickable or not (not very subtle approach). What about b) ? Exclude object from the camera for rendering, somehow?

Thanks in advance!

Ok I have found this playground, looks like some sort of a workaround can be parenting objects and testing against the container: https://www.babylonjs-playground.com/#BD4L6U#1

This does not solve it though.

Bump @MackeyK24 @Deltakosh

You can use predicated when calling scene.pick

This will let you decide which meshes can be tested and then you can use the layer mask or anything else to define which one should be picked


@Deltakosh thanks, this will do the job.

1 Like