is there any built in easy way to find the mid point of a triangle in a mesh.
Basically i want to find the nearest face and then cast towards it.
I can do nearest vertex on a mesh fairly easy but i want to cast towards the nearest “face” not the nearest mesh (this has importance due to wanting to take the nearest face of one object and rotate it to be parallel to another, as such nearest vertex really won’t work for me)
i’m not sure if there is a function that would do it easy (it seems like for lighting or something it’d actually be useful information so i was hoping it mgiht be built in somehwere)
if not the math behind it perhaps if you know it?
i’m thinking Maybe if you have points A B C
the mid point is something like
the intersection of line
A → midpoint of(B,C)
B → midpoint of (A,C)
C → midpoint of (A,B)
though i think that last step might be redundant i think C crosses at the same point as
A to mid and B to mid cross.
is this right?
Spark -- mathematically the midpoint of a triangle is incredibly simple. You just add all three vertices and divide by three. (Note that there are "different sorts" of midpoints in triangles - read any wikipedia article on it - but that's all you need for your situation.) Just as you say - you use this constantly, every other line of code, when dealing with mesh, lighting, collisions, whatever. sometimes you might keep a handy array, with that midpoint of each triangle in your mesh (just computer it before hand you know).
– Fattie