In my model I have using raycast to calculate the thickness of the cube. I want to know is it possible to disable raycast when the object is invisible, for example in my model the box3 is invisible and it is right side of the violet box.
here is my PG: https://playground.babylonjs.com/#XB49NT#31
Found this in the documentation Scene | Babylon.js Documentation
Think this might help:
Optional predicate: (mesh: AbstractMesh) => boolean
Predicate function used to determine eligible meshes. Can be set to null. In this case, a mesh must be enabled, visible and with isPickable set to true
your predicate will look like
sense that will return false if the mesh is not visible it will skip that mesh on the picking process.
Added two different picks to your double click thing so you can see how to do it. Id recommend going with the scene.pick one instead of the pick with ray. Unless its like a gun or something then do a pick with ray using the camera.getForwardRay(range)