intersectsMesh does not evaluate the correct position immediately after a mesh is created

Here’s a playground that demonstrates my issue:

If I create meshes in one function, and then check for intersections in a later callback, the results are as expected. But if I create 2 new meshes, change their positions so they do not intersect, and then check for intersections all in the same function, they are evaluated to intersect. Further testing shows that if I start with a mesh at 0, 0, 0, and another at 10, 0, 0, and then have a button callback create a third mesh at 10,0,0, and immediately test for intersections, this newest mesh intersects with the mesh at 0,0,0, but not the one at 10,0,0.

It behaves as though the position update has not taken effect before the intersection is evaluated. Is this expected behavior?

Hi @todd, you have to compute world matrixes after adjusting meshes position and before check intersections. I updated your example:

1 Like