Author Topic: Anchoring widgets with 3D root  (Read 1581 times)

pretender

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 155
    • View Profile
Anchoring widgets with 3D root
« on: April 19, 2014, 08:05:04 AM »
Hi! anchoring works very well with 2d setup and works as expected but i wanted to try 3D and spice it up a bit ;-)
basically i have health bar that i rotated a bit and trying to anchor to top left corner as it was with 2d setup. results are inconsistent and values are odd.

here is my setup

UI Root(3D)
 Camera (perspective)
 Panel (UIPanel)
  HealthBar (UISprite/UISlider)

I am trying to anchor to both UIRoot or UIPanel with unified anchor type, but it does not give me good results. I usually first move widget without anchors and then turn the anchors on and hopefully i get values setup for the position.

I am using latest NGUI but with Unity 3.5.7 (Should this anchoring work properly with perspective camera? and if so what is the proper way of doing it?)

Thank you very much!
   

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchoring widgets with 3D root
« Reply #1 on: April 19, 2014, 11:07:44 PM »
Anchoring was only meant to work with 2D, and not with 3D. There isn't much I can suggest here, other than don't use anchoring. Use math instead.

pretender

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 155
    • View Profile
Re: Anchoring widgets with 3D root
« Reply #2 on: April 20, 2014, 08:41:10 AM »
I would but i don't have a clue where to start and how to do it. Please point me in the right direction! Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchoring widgets with 3D root
« Reply #3 on: April 20, 2014, 04:34:31 PM »
Look at the code for UIAnchor. It's older, but I vaguely remember making it work for 3D as well.