i think the face 2 is calculate wrong
Hmm. Something is most certainly off.
If you are looking for a quick solution, this is it - PGDemo | Babylon.js Playground (babylonjs.com)
We will need to check what happened to the uv mapping in the pick result.
BTW - no need to run pick on each frame, babylon can do it for you (if you ask the scene nicely and set the flag to constantly update the mesh under the pointer )
1 Like
i need UV Cordinate not position
The result is correct actually.
The bu/bv are per face not per quad. so this is why your computation only work for the first half of the plane. you need to invert the computation for the second one.
This is why we provide a convenient way to get texture coordinates:
PGDemo | Babylon.js Playground (babylonjs.com)
Relevant code:
const uv = pickResult.getTextureCoordinates();
impact.position.x = uv.x * 20 - 10;
impact.position.y = uv.y * 20 - 10;
4 Likes
Thanks @Deltakosh
1 Like