Author Topic: Adjusting panels, buttons and controls when Changing camera FOV  (Read 4550 times)

simon.anderson6

  • Guest
Adjusting panels, buttons and controls when Changing camera FOV
« on: November 22, 2013, 01:39:45 AM »
Hi there,

I'm new to NGUI and was hoping someone could help me out.  I'm working on a 3rd person scene and My HUD shows details such as time remaining etc.  with an anchor.

The user has the ability to zoom out via pinching/mouse scroll.  When this happens I simply increase/decrease the camera's field of view.  The problem is the panel, a child of the anchor attached to the camera (camera->anchor->panel) and all it's children stay the exact size and location and hence get zoomed in/out of also.

I'm not sure what the best way to handle this situation is (was thinking maybe just move the camera in/out instead of changing fov, although this is not ideal).  Any suggestions would be greatly appreciated.

Thanks,
Simon

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Adjusting panels, buttons and controls when Changing camera FOV
« Reply #1 on: November 22, 2013, 03:25:01 AM »
Assuming your pinching affects the main camera's FOV, You need to also have it affect the UI camera's FOV (you are using different cameras, right?).

Aside from that, just set your anchors to "run only once".

simon.anderson6

  • Guest
Re: Adjusting panels, buttons and controls when Changing camera FOV
« Reply #2 on: November 22, 2013, 06:59:36 AM »
Hi ArenMook,

Thanks for the response - I only have one camera (the UI camera) which is also the main camera.  The user pans this camera around the map scene by swiping the screen. 

I'm not sure why I need two cameras?  Are there side effects from setting the main camera to be the UI Camera?  If so does that mean I should parent a UI Camera to the main camera and move the main camera around instead?

Thanks,
Simon

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Adjusting panels, buttons and controls when Changing camera FOV
« Reply #3 on: November 22, 2013, 03:46:27 PM »
If main camera is your UI camera, then you can't use anchors as the main camera is likely going to move around.

The UI camera should be stationary.