Reputation: 1090
For reasons of collision detection, I am attempting to iterate through all the triangles in my model.
However, how can I get them?
OBJ files start each vertex position information with a "V". I cannot see how to get a triangle of three vertices from that, since I can't know which vertices make up the triangle.
I don't care what order the triangles are iterated through in, as long as I am able to get the triangle. How can I get it?
Upvotes: 0
Views: 216
Reputation: 7057
After enumerating all vertices, obj files also list all triangles (faces to be precise) in terms of those already defined vertices.
Faces can be polygons but mostly they are quadrilaterals or triangles.
In case of a triangulated model, faces are declared as follows in an obj file
f 10 11 12
This means a triangle comprising of 10th, 11th and 12th vertices.
Upvotes: 1