Author Topic: NGUI and OCULUS : UIFollow  (Read 6238 times)

justinISO

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 52
    • View Profile
NGUI and OCULUS : UIFollow
« on: June 25, 2015, 11:35:40 AM »
Hello, I am using NGUI to display a hud in Oculus (think Iron Man). I have a some little things animating on the edge and a reticle that locks on to an object when a raycast from the center is hitting the collider.

When in the editor for the proof of concept I just used a standard NGUI 2D UI to draw the HUD and I use UIFollow from the HUDText package to lock the reticle on an object. That works great.

Now when I switch over to Oculus I changed the UI to more of a 3D UI by drawing the HUD elements on the right side oculus camera (instead of an NGUI camera). Everything is great except the reticle lock on with UIFollow. I tried setting the game and gui camera to the Oculus right side camera and that is way off. When I change the gui camera of UIFollow to the ortho ngui cam from the original 2D GUI it is close but still has a lot of travel as I look around. Any ideas how to make it lock like the 2D UI?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI and OCULUS : UIFollow
« Reply #1 on: June 25, 2015, 09:23:50 PM »
2D and 3D UIs are quite different. UIFollowTarget is meant for 2D cameras. 3D are much more complicated as they have a 3rd dimension (depth), while UIFollowTarget sets Z to 0. When overlaying an object, you basically end up with 2 coordinates (screen XY), and there is no depth.

justinISO

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 52
    • View Profile
Re: NGUI and OCULUS : UIFollow
« Reply #2 on: June 26, 2015, 09:11:58 AM »
So is there a way to modify UIFollow to account for depth?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI and OCULUS : UIFollow
« Reply #3 on: June 29, 2015, 07:10:55 AM »
I can't offer you a solution off the top of my head, no. You can try using the regular widget anchoring instead. You can anchor any widget to follow any object, including a 3D one... but again the system was really designed for 2D UIs, not 3D.