Reputation: 678
In one of the rendering scenarios I have my camera focused at the tip of an arrow. I scale the arrow and the camera focus gets changed. How should I calculate the required translation value for the arrow to counter the translation happened due to scaling and keep the camera focus unchanged ? (I cannot alter the camera variables)
Assuming the red circle to be the camera focus point. The second frame is showing the desired behavior.
Upvotes: 0
Views: 154
Reputation: 11597
If you translate your camera to the origin, scale it, then translate it back (translate by scaled amount) that should place your camera at the right spot. Scaling things when not at the origin tends to make them move away from the origin, since their position gets scaled as well as everything else.
Upvotes: 2
Reputation: 2573
What do you call "camera focus"? Is that something you have created? or something inside OpenGL?
I would apply the transformation from that specific point. The center of scale, i mean. That way you would mantain the position.
Upvotes: 0