- Home /
Question by
ffsilvasurfa · Apr 23, 2020 at 01:08 PM ·
joysticklookatmouseposition
replace mouse position with right joystick direction
in my script a shield that rotates around the player points at the mouse position. i would like it to also work with the direction the right joystick on a controller is pointing. this is my code:
if (target == null)
{
Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
transform.LookAt(mousePos);
}
the shield is parented to an object with that script at an offset so it rotates around.
Comment
Your answer
Follow this Question
Related Questions
Touch ID ????? 1 Answer
LookAt and fire at mouse position 2 Answers
Input.mouseposition is confused by multiple clicks 1 Answer