Hi!
Basically, I’m making a 2D game and my right joystick controls my character rotation, and my left joystick controls the movement.
I’m trying to find how to get which direction my left joystick is moving in relation to where the character is facing, so if he were facing right on the screen and I were holding up on the left joystick, I would get an X value of 1 rather than Y.
Sorry if this is simple maths! I’m terrible at that.
Thanks in advance.
Ended up doing it like this but I’m sure there must be a better way
float xDot = Mathf.Clamp(Vector2.Dot(movementInput, spriteTransform.right), -1f, 1f);
float yDot = Mathf.Clamp(Vector2.Dot(movementInput, spriteTransform.up), -1f, 1f);