Hello Guest

Author Topic: Zoom factor  (Read 5070 times)

emorrisgames

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Zoom factor
« on: September 02, 2013, 10:29:31 am »
Hi.
I wanted to try and set up at 2.5D scene using two tk2dcameras, one orthographic for sprites, and one perspective for 3D geometry. When I was playing around with the cameras I noticed that when I make the zoom factor smaller on the orthographic camera it zooms out and the game characters get smaller, but when I make the zoom factor smaller on the perspective camera it does the opposite and zooms in. I was just wondering if there was a reason for this? Thanks.

gary-unikronsoftware

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 74
    • View Profile
Re: Zoom factor
« Reply #1 on: September 02, 2013, 11:21:15 am »
Hi,

Yes there is a slight coding error in the camera code which means perspective zooming works the opposite way to orthographic zooming.  This will be fixed in the toolkit shortly, but in the meantime in tk2dCamera.cs if you find the line:
Code: [Select]
float fov = inheritedCameraSettings.fieldOfView * ZoomFactor;

and change it to

Code: [Select]
float fov = Mathf.Min(179.9f, inheritedCameraSettings.fieldOfView / Mathf.Max(0.001f, ZoomFactor));
this should fix it.

emorrisgames

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Zoom factor
« Reply #2 on: September 02, 2013, 11:23:29 am »
Ok thanks for that.