Point is inside a mesh functionality

Hi,
I wanted to check if the point is inside a mesh. I have used the following sample.

Check if Point is Inside a Mesh | Babylon.js Playground (babylonjs-playground.com)

But when my mesh is rotated, the logic doesnt seem to work. Can someone help me out with this.?
Moreover, when I use it in the workspace, I get an infinite loop.
Check if Point is Inside a Mesh | Babylon.js Playground (babylonjs-playground.com)

You must update the world matrix after you rotate mesh, by calling mesh.computeWorldMatrix().

Regarding the infinite loop, you can fix it by breaking the loop if hitCount is greater than a given value. However, you won’t be able to categorize the point in that case… Maybe you can instead try to use a greater value than 0.00000001 when looking for the next intersection.

1 Like