Advertisement

Translate vector to another coordinate system

Started by June 02, 2020 06:45 PM
4 comments, last by _WeirdCat_ 4 years, 8 months ago

I've started working with graphics and now managed to implement a fixed camera that looks at a specified point (target point) in world space. Now I wanted to implement camera movement like in Blender, so using shift + mouse I can move my camera in its local space and move it left or right (by its local X-axis) (orthogonally to the target point). And now I want to also move the target point in the same direction as the camera movement but I'm moving my camera in its local space but the target point is in the world space (different coordinate systems). So I thought that the easiest way to move the target point is to just get a unit vector by the camera local X-axis and translate it to the world coordinate system and just move the target point by this vector. But I'm not good at math and I just started working with this field and can't understand how do I translate my vector from one coordinate system to another. Help, please!

P.S. I'm talking about 3D space btw.

Cameras do not require a target point. Release the target and just move the camera freely in world space, using mostly cross product for side to side movement. My toy engine does this when RMB is held down.

ED: I may have misunderstood. You want to carry (attach) the target with the camera?

🙂🙂🙂🙂🙂<←The tone posse, ready for action.

Advertisement

@fleabay No, I want to translate the vector from one coordinate system to another. I just told about what I'm trying to do. The thing is that my camera is using the Spherical coordinates to fly around the target point just like in Blender. So using MMB I can rotate the camera around the target point in Spherical coordinates. And using Shift + MMB I want to move my camera not in the Spherical coordinates but just move it left/right orthogonally to camera's forward vector. And I managed to do it, I'm just moving my camera in its local coordinate system. Now, moving my camera by the vector (along the local X-axis - left/right) I also want to move my target point by this vector but the target point's coordinates are described in the world coordinate system. So I need to translate my vector from one coordinate system to another. That's it.

Well, I've figured out a better solution for this problem.

Yet we still dont get it

This topic is closed to new replies.

Advertisement