- Home /
Question by
ina · Jan 02, 2011 at 05:21 AM ·
meshproceduralcoordinatesface
World Coordinates of face on a mesh
How do you find the world coordinates of (the center of) a face on a mesh? How do you reference a particular face on a mesh?
Comment
Answer by Jesse Anders · Jan 02, 2011 at 06:28 AM
It depends on what you're trying to do, but generally speaking, you would access the mesh data via the Mesh class (or possibly just access the original data directly if the mesh was created procedurally), and then transform the desired point using (e.g.) Transform.TransformPoint().
Beyond that though, I think some more detail is probably needed.
well, how do you get the center coordinate on an arbitrary face/poly on the mesh?
A fairly standard and straightforward solution is to average the three vertices of the triangle, e.g. centroid = (v1 + v2 + v3) / 3.