• Advertisement
Sign in to follow this  

Associate game coordinates and system coordinates

This topic is 3571 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement