Sign in to follow this  

Face Specifics

Recommended Posts

Hey everyone!
does anyone at all know how I can calculate the width of a face so I am able to get the TL, TR, BL BR (Top Left, Bottom Left etc) values correctly.

I am able to draw all the verticies perfectly well and am able to view them in blender and a game engine being written, the thing is I need to be able to calculate the texture coordinates to allow for shift, stretch etc, to do this I need to get the above values and perform a calculation on them and I am unsure how to obtain these values when some of the faces have more than or less than 4 verticies.

any help would be greatly appreciated.


Share this post

Link to post
Share on other sites
If you are looking for the width between two points, its as simple as find the distance between the two points (dX= TR.x - TL.x, dY= TR.y - TL.y ), then distance can be calculated by taking the square root of

distance = squareroot(dX[size="4"]² + [size="2"]dY[/size][size="4"]²)

[/size][/size][size="2"]Of course, if you just want the distance along a single axis between two points, it's just a matter of point2.x - point1.x == width

Truth of the matter is, I don't think this is what you are looking for, what you want is UV coordinates.

Share this post

Link to post
Share on other sites
I was under the impression that if I am able to calculate the following sum:

'256 / 64 * 0.25'

256 = texture width
64 = face width
0.25 = the stretch

then the total is == 1

which is the kind of coordinates I was expecting? is this not correct?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this