Advanced Question Getting VC camera direction

Max-Q

99 40
Addon Developer
Joined
Jul 5, 2021
Messages
794
Reaction score
1,263
Points
108
Location
Cislunar Space
Website
www.orbiter-forum.com
So I'm trying to get the current VECTOR3 direction of the camera in the VC.
Right now, I'm using oapiCameraGlobalDir() to get the camera direction and Global2Local() to convert it to local vessel coordinates, but it doesn't work. The result is nowhere close to where the camera is actually pointing in the VC however.
Any help would be appreciated, thanks!
 
Yes, because Global2Local converts positions, not directions. For your case, you need to use GetRotationMatrix() and perform the reverse transform.
 
I just tried that, and it's doing the exact same thing.
I get the same result using my Global2Local method, multiplying by the matrix returned by GetRotationMatrix(), and multiplying by the inverse of GetRotationMatrix().
 
Back
Top