Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Image rotates with the movement of a player

Discussion in 'Scripting' started by Focuserino, Dec 9, 2020.

  1. Focuserino

    Focuserino

    Joined:
    Dec 5, 2020
    Posts:
    2
    Hey guys,

    I started with my very first Unity project one week ago. I have a little problem now, which I can't solve.
    My current situation is the following: I created a GameObject, which is basically the player (it's first person perspective). Furthermore I have an underground and on this underground there is a simple cube. Above the cube there is an image (which is a formula). I added a picture of the game view. Now what I want to do is, whenever the player is moving around the cube, the image should look at the player.

    Does anybody have a simple and understable solution for my problem? (Remember I'm a noob in unity :D )
     

    Attached Files:

    • game.PNG
      game.PNG
      File size:
      45.2 KB
      Views:
      258
  2. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,077
    If you're making it face the camera it's usually called 'billboarding' - there's an example here of a script that will make your object face the camera https://wiki.unity3d.com/index.php/CameraFacingBillboard

    You could modify it to face any object though, try adding a reference to a player GameObject and then modify the code to use that instead of the camera transform.
     
  3. rmccoach221b

    rmccoach221b

    Joined:
    Apr 2, 2020
    Posts:
    2
    You could use a UI canvas?
     
  4. Focuserino

    Focuserino

    Joined:
    Dec 5, 2020
    Posts:
    2
    Thank you so much! It really helped me. Got it now :)
     
    tonemcbride likes this.