Associate game coordinates and system coordinates

Started by
0 comments, last by Numsgil 15 years, 11 months ago
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
http://www.daily-it.com
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.
[size=2]Darwinbots - [size=2]Artificial life simulation

This topic is closed to new replies.

Advertisement