Need help with new Unity Input System and mouse aiming

Hey Everyone! I am having a struggle to make mouse aiming in my sidescrolling platformer with new input system. The thing is, i am trying to do something similiar to this in video: https://youtu.be/-bkmPm_Besk

But right now, i only can read the position of the mouse on a screen
i would greatly appreciate if somone could guide me to a good info source on how to make this right because i can not find some good examples on google or StackOverflow.

As allways on forums, i manage to figure this issue myself.

I made code like this.:

void MouseDirection()
{
    Vector2 mousePosition = Mouse.current.position.ReadValue();
    mousePosition = Camera.main.ScreenToWorldPoint(mousePosition);

    Vector2 direction = new Vector2(mousePosition.x - transform.position.x,
                                    mousePosition.y - transform.position.y );
    transform.right = direction;
}

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms