Hello, I am trying to find out if an object/user is on top of a platform which is a merge mesh of boxes. Ray intersects with the ground/platform will return hit === false for some parts of the mesh/platform. (This is also happening when I create the platform using ExtrudeShape)
cc @Cedric
I think the “problem” is changing platform’s position (zigzagGround.position.z = -20); the physicBody visually is moved but ray check doesn’t identify it. I added an extra(D) ray on position that hits the platform when platform.position === (0,0,0) I moved again platform.position.z = -20 and ray D visually doesn’t hit the platform but ray.intersects report as it hits
A good test would be to do raycasts with origin points on a X/Z plane and see where it hits by changing raycast color.
Either there is a bug in physics engine raycast code or an issue in coordinate transformation in Babylon layer.
EDIT: intersects method doesn’t use physics engine.
EDIT2: explanation is in this page : Babylon.js docs
ray neede to be transformed into mesh local coordinates, or in other words, it needs to be transformed by mesh world matrix inverse.
Or use the intersectsMesh
like in this PG: https://playground.babylonjs.com/#NJ0ARO#5