How to make a ray casted detect only the back face of cube?

In my scene, I have a cube with the sideOrientation option set to mesh.BACKSIDE when I cast a ray it picks the point from the front side of the cube if the ray intersects the front side. How to make the ray only detect the backside?

Assumption - The point you are getting is not the front side, it is the backside of the face facing you. I assume you want to ignore to ignore the first face and get the point inside the cube (the one facing the camera)?
Want to share a playground?

@RaananW here you go. As you will see here the pickedPoint is at the frontside of the cube although I specified the sideOrientation to be Mesh.BACKSIDE

Sorry for the super-naive approach, but you could do something like this:

Ray detects frontside | Babylon.js Playground (

I.e. - pick from the original ray’s pickedPoint (plus a little from the direction) and wait a second hit. Not very performant TBH, but will give you the point you are looking for.
I was actually pretty sure that the pick will take the normal direction into account as well, but actually it just checks triangles and looking for collision.

1 Like