How would I make the mouse go in a full circle and not create negative degrees?
Im trying to make a turret system where the seat will follow the mouse rotation, however the mouse doesn't seem to make a full circle in degrees 0-360 instead it goes from 90 to -90. Im using a hinge so i have to convert the mouse pos to degrees. How would I prevent the mouse degrees from going negative and instead make it follow the 0-360
Code
01 | local player = game:GetService( "Players" ).LocalPlayer |
02 | local mouse = player:GetMouse() |
03 | local hinge = workspace.mover:WaitForChild( "HingeConstraint" ) |
04 | local runService = game:GetService( "RunService" ) |
09 | runService.RenderStepped:Connect( function () |
11 | mouseang = -math.asin((mouse.Hit.Position).Unit.X) |
12 | degree = math.deg(mouseang) |
14 | hinge.TargetAngle = degree |
Here is a video of whats happening
https://media.giphy.com/media/NTyexgTq6AZFpPdN9Y/giphy.gif
How would I make it so it goes around the back too?