Search Unity

world Space Ui

Discussion in 'Scripting' started by limaoscar, May 8, 2018.

  1. limaoscar

    limaoscar

    Joined:
    Nov 16, 2016
    Posts:
    22
    I have an issue with world space UI and i'm stuck with this problem,
    I'm currently using a Rift attaching the UI as a child of the tracking space object of the controller i access the Ui via a button press on the controller.

    But as the issue i have is when the controller rotates the menu rotates this is the effect i want i would like the Ui to always face up regardless of the rotation of the parent.

    my first attempt was to create a vector3 of the transform
    Code (CSharp):
    1.  targetpos = new Vector3(transform.position.x, 1.0f, transform.position.z);
    2.                                            transform.rotation = Quaternion.LookRotation(targetpos,Vector3.up);
    3.      
    4.         Debug.DrawLine(transform.position, targetpos, Color.red);
    5.  
    Im kinda stuck any ideas ?

    The image bellow is the type of thing i would like
    [EDIT]
    Image not loaded in the post added the link;

    http://vrux.design/wp-content/uploads/2017/01/toybox-768x497.jpg
     
    Last edited: May 8, 2018