Scene freezes when using a ray pick and intersection

Hi!

https://playground.babylonjs.com/#LPX1FM#31

Here is my scene, and I’m trying to detect when a person is on the ground. Before on line 322 it would detect if playerj was intersecting ground. I added a ray that points down. It should detect the ground mesh, allow you to jump, and then for the custom meshes in front of you, it should do the same. I’ll add more rays, but this is a test. I works for a second, but then stops and freezes.

Why the freeze?

Thanks, Givo.

I figured out that the ray was still checking for the mesh even if the ray was not hitting anything. fixed by adding another conditional testing if the ray hit anything.

1 Like