for (var i = 0; i < scene.meshes.length; i++) {
if (mesh.intersectsMesh(scene.meshes[i], true)) {
//I do stuff here
}
}
And with a consle.log it says that the mesh is colliding with itself, even though it’s not? That’s confusing, but I’m pretty sure a thing can’t intersect with itself because it’s kinda obvious that if it could then it would always be intersecting itself.
So how do I filter out the collision with itself? I have 3 meshes: mesh, ground, and wall.
Here my pg. I tried that, but a little different. I have if scene.meshes[i].name != car . Is it any different if iI use scene.meshes[i] or scene.meshes[i].name?
Greeeat!
As a suggestion, you can add your obstacles in a different array and check all the time the meshes from that array instead from the entire scene, cause you can have 1000 meshes in the scene, but maybe you want to check intersection with only 5 of them. Cheers!