Given 2 functions Translate(x,y) and Scale(x), I want the camera's position to always be the center of the screen. There is also a scalefactor variable and by modifying it it either zooms in or out from the center of the screen. Given that I know the dimensions of the screen in pixels, how could I achieve this? Thanks
A:
Something like this:
screen_coords = (world_coords - camera_world_coords) * camera_zoom + 0.5 * screen_dimension
tdammers
2010-08-29 14:05:21
How does this work in terms of Translate() and Scale()?
Milo
2010-08-29 14:07:20
@Milo: You're not going to get perfectly working code here. SO is not a "Send me code that does X" site. Read the equation tdammers posted and implement it in terms of Translate and Scale.
Billy ONeal
2010-08-29 14:42:55
Hint: the * operator in my example is a scale, the + and - operators are translates. If you can't figure it out with this information, go back to the grindstone.
tdammers
2010-08-30 11:22:10