Hi,
For my implementation I want the player to rotate towards the mouse direction and only allow combo to succeed if the following click is within the time and in certain max angle difference.
Circle is the click point and I want to limit the range like this, so that player can slightly adjust the direction
I am getting a mouse position by:
Vector3 mousePoint = Camera.main.ScreenToWorldPoint(Mouse.current.position.ReadValue());
I set the direction:
Vector3 direction = mousePoint - stateMachine.transform.position;
Noticed in other rotation we do we set the y to 0:
direction.y = 0f;
And then I try to rotate:
stateMachine.transform.rotation = Quaternion.LookRotation(direction);
What am I doing wrong? The player object is rotated south on each click.
EDIT:
For some reason with just this code no matter where I click I am getting same value like:
(0.00, 16.06, -8.50)
Vector3 mousePos = Mouse.current.position.ReadValue();
Vector3 mouseWorldPos = Camera.main.ScreenToWorldPoint(mousePos);
Debug.Log (mouseWorldPos);