Search Unity

How do I rotate an UI object along one axis

Discussion in 'Scripting' started by HeldomLtd, Jun 16, 2018.

  1. HeldomLtd

    HeldomLtd

    Joined:
    Mar 24, 2017
    Posts:
    2
    I am currently trying to create an effect with eyes at will rotate towards the location of the cursor. The problem I have is, I am trying to do: transform.LookAt(Input.mousePosition.z); but because it is looking for the z-axis, it needs a Vector. There is no Vector1 option though. What can I do?
     
  2. Doug_B

    Doug_B

    Joined:
    Jun 4, 2017
    Posts:
    1,596
    Is this in 2D (side view of face) or 3D (i.e. viewing face from the front)?

    It may be worth noting that whilst the mousePosition is a Vector3, the z element is always zero.