I have a top down 2D scene where the player moves up/down in the z axis and left/right in the x axis. I’d like to rotate the object to the point in the same direction as the the joystick and reflected instantaneously, not linearly too if possible.
I’m not sure what the proper math is to do this but I have the inputs below…
float horizontal = Input.GetAxis("RightAnalog_horizontal") * Time.deltaTime * moveSpeed;
float vertical = Input.GetAxis("RightAnalog_vertical") * Time.deltaTime * moveSpeed;
I’ve tried a few ways of doing this including the following rotations with no luck…
shootPoint.Rotate(new Vector3(0, hr, vr));
shootPoint.rotation = Quaternion.Euler(0.0f, (Mathf.Atan2(vertical , horizontal ) * Mathf.Rad2Deg), 0.0f);
Any help would be greatly appreciated.