1
$\begingroup$

I want to control the camera in an old game using head tracking (TrackIR, opentrack, etc.), such control was not provided by the game engine. I'm trying to find the camera coordinates and rotation angles in memory so that I can recalculate them with my program. I haven't worked seriously with 3D until now. So far I have found some float array in memory and am trying to figure out how it works.

In the main menu of the game, when the map is not yet loaded, the values are: enter image description here

In the loaded map, I have screened 3 states when looking parallel to the axes of the map. In a practical way, moving around the map, I found the coordinates X, Y, Z (Z - height) enter image description here

Googling a bit, I think it's possible "View matrix" or "Rotate matrix". I ask for help from those who understand 3D, did I determine correctly? Links to articles on how it works are welcome :)

$\endgroup$
2
  • $\begingroup$ What you are asking is confuse. What is your question ? $\endgroup$
    – user1703
    Apr 4, 2023 at 18:26
  • $\begingroup$ The topic of 3D rotation is not so easy. en.wikipedia.org/wiki/Rotation_matrix#In_three_dimensions In addition to rotation, translations are handled with a $4\times4$ "affine" matrix. $\endgroup$
    – user1703
    Apr 4, 2023 at 18:28

1 Answer 1

1
$\begingroup$

Yep, that looks like a view matrix. A matrix can be stored in either row- or column-major order; that one appears to be column-major. As you’ve identified, the last row / column of it (the values you’ve marked as X, Y, and Z) are the camera position (followed by a 1, for complicated reasons); that would make the other three rows / columns the X, Y, and Z basis vectors (at …98, A8, and B8 respectively).

As Yves noted in the comments, getting a rotation out of those vectors is tricky. Fortunately, you may not have to: your head-tracking library should be able to give you a transform matrix containing the axes of the camera with the appropriate rotations applied. If you plug those values in to the appropriate places in your in-memory matrix (…and possibly spend some time swapping them around and/or negating them, to line up with whatever coordinate space your game uses), you should be good to go.

$\endgroup$
1
  • $\begingroup$ Thanks for the detailed answer. I agree that this is a difficult task and I will have to sit for many hours at the disassembler before I understand how to control the camera. But I'm ready for it. $\endgroup$
    – F4rrell
    Apr 6, 2023 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.