开发者

Ensure camera position is always the center of the screen?

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开发者_JAVA百科 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


Something like this:

screen_coords = (world_coords - camera_world_coords) * camera_zoom + 0.5 * screen_dimension
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜