addi wrote:Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
if grad < 0 then grad = grad + 360 end
It would be better to do this instead:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
grad = grad % 360 --returns the remainder after dividing by 360
This will force grad to be within 0-360 whether grad is positive or negative and will not effect it if it is in that range. As a bonus it will automatically convert 360 to 0.
As for get_look_yaw I have no clue what it is doing but if it is returning a normal radian value then your code local grad = player:get_look_yaw()*180/math.pi should convert the angle to degrees where 0/360 is on the right.
It sounds like your axis is flipped like so:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
so if you just subtract 90 each value moves clockwise one position
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
First of all you should subtract 180 to get 0 on the right.
However, rotating your axis isn't what you want to do(that is if you want 0 to be on the left and 90 up). Instead you need to flip the entire axis like this:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
I'm not sure how to do this off the top of my head, but if I get some time I'll think about it.