2D Toolkit Forum

2D Toolkit => Support => Topic started by: ty_alpha on March 25, 2014, 08:10:40 pm

Title: ZoomFactor and Updating ScreenToWorldPoint
Post by: ty_alpha on March 25, 2014, 08:10:40 pm
I'm currently using a perspective tk2dCamera in my project and I'm trying to implement zooming through the ZoomFactor, which is so far working exactly as expected.

However, what I want to do is (all within one frame):

I've tried using a new Camera with .CopyFrom(my original tk2dCamera), as well as using .ResetAspect(), .ResetProjectionMatrix(), and .ResetWorldToCameraMatrix(). So far I can't seem to get anything to work. It seems to need the camera to render at the new ZoomFactor, but that's exactly what I'd like to avoid.
Title: Re: ZoomFactor and Updating ScreenToWorldPoint
Post by: unikronsoftware on March 26, 2014, 10:43:18 am
The camera matrix is only updated at the end of the frame. You can force an update immediately by calling tk2dCamera.UpdateCameraMatrix()
Title: Re: ZoomFactor and Updating ScreenToWorldPoint
Post by: ty_alpha on March 26, 2014, 03:55:57 pm
Thanks - that's exactly what I needed.