Answer the question
In order to leave comments, you need to log in
How to implement in Unity so that the head of a 2D character follows/follows the cursor?
How to implement in Unity so that the head of a 2D character follows/follows the cursor? Those. the player moves the cursor, and the head constantly looks in the direction of the cursor. I wanted to implement this through a bone in the skeleton for animations, but I did not figure out how to rotate the bone through the script. Tell me something.
Answer the question
In order to leave comments, you need to log in
It is necessary:
1. Determine the coordinates of the cursor.
2. Create a vector in the direction from the sprite coordinates to the cursor coordinates.
3. Rotate the sprite according to this vector.
Unfortunately, you didn't indicate which of these items you had difficulty with, which is why no one answers you for so long.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question