I am having a little problem with a script for the android which has to turn a level clockwise and counterclockwise depending on the angle of the moved finger, so far i am stuck at trying to get it to work on the computer
im having a similar problems with the Vector2.Angle function. it always reads 90º for some reason. i’m comparing a Vector2.zero to a joystick position(x and y are between -1 and 1) to try to get the rotation angle.
If anyone knows how to fix it would be very helpful. thanks.
Heres my code snipet:
And here are some examples of the debug log that shows the angle:
Ya, i know how to get it mathematically but didn’t see the point as there was already a function.
Anyway turns out the first vector2 isn’t supposed to be a reference for the the centre of the circle, but it actually a second vector to compare it to.
So all i needed to do was change the first Vector2 to Vector2(0,1) and it works. but as it only goes between 0 and 180, i modify it a little. to get the actual value.