Author Topic: Anchor issue in 3D UI  (Read 1710 times)

artem

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Anchor issue in 3D UI
« on: May 27, 2014, 02:45:52 PM »
Hi,

I'm upgrading my project from free NGUI to latest commercial version and run into odd issue with anchors when using them with 3D UI and perspective camera.

Looks like anchors don't work correctly with any values of far clipping plane except default value (4).

Steps to reproduce:

1. Create a new scene with 3D UI
2. Set camera far clipping value different from default (for example 40)
3. Create a colored button control
4. Set its unified anchor binding to left
5. Resize game window
6. Observe that anchor is not bound to the left edge

I did the same test with legacy anchors in free version of NGUI and it works perfectly there.

Any ideas what I'm doing wrong?

Thanks,
Artem

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchor issue in 3D UI
« Reply #1 on: May 28, 2014, 05:43:16 AM »
Anchors are for 2D UIs -- they are always two-dimensional. Anchoring something to a perspective camera won't work because it involves 3 dimensions.

artem

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Anchor issue in 3D UI
« Reply #2 on: May 28, 2014, 07:25:24 AM »
Ok, thank you for the answer.

How do I bind a widget to a screen corner with perspective camera then?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchor issue in 3D UI
« Reply #3 on: May 28, 2014, 07:49:43 AM »
Try using the legacy UIAnchor component.