intersectsMesh behaviour

Yo altogether,

my next small project is a simple Mesh Intersecting Example, to understand the suiting method for projectiles/bullets. For some reason my intersectsMesh gives true even if there is no intersection. Are there some position data used that are not up-to-date or does .dispose() cause problems?

My simple Mesh Intersection PG: https://playground.babylonjs.com/#F6CXJA#7

Edit: I tried using computeWorldMatrix for both meshes before intersectsMesh or registerAfterRender. And used true as second parameter, to be more precise. It got better from calculating ~10 intersections to 4 intersections when bullet intersects target.

Also I switched to scene.onBeforeRenderObservable.add and SPS, but result is the same.

Solved it, just replace

delete bullet;

by

delete bullets[bulletKey];

1 Like