Wavefront mesh: determine which face a point belongs to?

Posted by Mina Samy on Game Development See other posts from Game Development or by Mina Samy
Published on 2012-11-28T11:04:51Z Indexed on 2012/11/28 17:20 UTC
Read the original article Hit count: 285

Filed under:
|
|
|

I have a 3D mesh Wavefront .obj file.

Is there any algorithm that takes an arbitrary point coordinates as input and determines which face of the mesh that point belongs to ??

The mesh is rendered on the screen, then the user clicks on it, I want to determine which part of the mesh the user has clicked on ?

Here's the code using LibGDX:

Vector3 intersection=new Vector3();
Ray ray=camera.getPickRay(x, y);
//vertices is an array that hold the coordinates of the mesh
boolean ok=Intersector.intersectRayTriangles(ray, vertices, intersection);

Thanks

© Game Development or respective owner

Related posts about libgdx

Related posts about 3d-meshes