Sign in to follow this  
TiitHns

Associate game coordinates and system coordinates

Recommended Posts

How you guys reccomend to associate game coordinates to system(OpenGL) coordinates. On system coordinates character is standing on x:0.0f y:0.0f z:0.0f but in game x:50.0 y:123.0

Share this post


Link to post
Share on other sites
Use an affine transformation to transform a point in game space to a point in OpenGL space (or between any two spaces really).

An affine transformation is usually represented as a 4x4 matrix, used to transform your position as a 4D vector (ie: your position vector would look like <50, 123, 0, 1>). If you're not comfortable with that sort of thing, you could do essentially the same thing using a translation vector and a rotation/scale matrix. First rotate/scale your point then add the translation vector to arrive at a new point.

If your two systems have the same scale and orientation (so your scale/orientation matrix is an identity matrix), then you would simply add some vector to your point representing the difference between game and OpenGL coordinates.

Most of this is actually handled by OpenGL if you know what to do. When you set up your projection matrix, you can specify a matrix that will handle all of this for you.

Hope that helps.

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