# How can I solve for the game's world coordinates?

I've used 3DReaperDX to get a obj file, the header information are shown as follows:

#AR=2.00606, FOV=45.09583(height), Xscale:0.83290, Yscale:0.41519, Zscale:1.0
#**************************************************
#ALPHABLENDENABLE: No
#ZENABLE: Yes
#ZWRITEENABLE: Yes
#TWOSIDED: No
#INVALID: No
#THIN: No
#RENDERTARGET_IS_BACKBUFFER: Yes
#WIDTH_DO_MATCH: Yes
#RGBWRITEDISABLED: No
# object DrawCall_0 to come ...
g
v 2143.35547 6654.99023 25835.37109
v 2243.17773 6296.61523 25957.53906
v 2343.00000 5856.84473 26093.97656


How can I get the game's world coordinates.

For example: I can map the scaleTransform to the VertexData

scaleTransform={X1scale,Y1scale,Z1scale} {0.8329,0.41519,1.}

Is the obj file enough to get the game's world coordinates? I want to put a object in this ground, and the coordinates is the same to that in the Game Engine,

And I can place something(with some fixed coordinates) in the Game and then to use 3DReaper to get the obj file. If the file is not enough itself to get the game world coordinates.

• What does "get the game's world coodinates" mean? If you mean the object's world coordinates, what's wrong with the ones you've captured? World coordinates are typically what's plugged into the input assembly stage. Nov 4, 2013 at 5:22
• @SeanMiddleditch If I put a object in the game in {5000,0,5000}, maybe the object in the captured coordinates is {3000,-499,6000} Nov 4, 2013 at 5:32

You really should try to ask a better question.

Anyways, While there is some likelihood that your were returned coordinates in model space, or even view space. it looks very much that the coordinates are in post ModelWorld transform, and pre ViewProjection transform. That would then make the coordinates in "World space" But even if this is true, the game can do all sorts of weird things with their matrices. And even weirder things (Or the same things, yet more likely) if it's a more modern game using no fixed-function matrices.

So, given your question, I figure there are three possible things you could be wanting:

• The coordinates in model space. These are an points in local space, as they would be coming out of the editor, and entering the game engine.
• The coordinates in world space. This would be the points in the scene or world, placed relative to other objects in the scene, This generally varies as objects move in the world.
• The position of the object in world space. This is the position you use to get points in local space, into world space, and the point the game engine uses to represent the "position" of an object.

And in addition to those first two spaces, the points you have could also be in view space, which is everything in the world, brought into a space where vertices are relative to the camera location and rotation.

(Technically, you could be in projected view space also, but in that case you shouldn't be seeing numbers outside of say -1.0 to 1.0, depending on the API in use)

So, to convert from one space to another, we need to use the proper matrix:

• To go from model space to world space, you use the model transform matrix. Which is a matrix created from the models scale, rotation and translation.
• To go from world space to view space you use the camera transform matrix, which similarly is created from the camera's rotation and translation.
• And any of these matrices can be inverted to go in the reverse direction, so we'd talk about the inverse model transform matrix, or the inverse camera transform matrix in that case.

And if you didn't want vertex coordinates at all, and just want the objects position, that can be extracted from the 4th column of the Model transform matrix.

Adly any of that data is not contained in an obj file. and in all likelihood cannot be extracted in an easy and simple way from the game that's not very specific to the game. However you may not need it. Depending on your use case, you may just be able to get the geometric average of the points in question, and consider that the center of that coordinate space, and perhaps some other fix ups on orientation but it really comes down to what your use-case is.

• Thanks, I solved it by some test. Build a group of objects and put them in the game, and then capture the group objects. then solve for the transformation between group1(in the game) and group2(captured) Nov 28, 2013 at 16:30