I’m attempting to make a custom joystick for mobile players. The joystick does work but I was wondering if I could make the JoyStick move around in a circle radius rather than a box.
I’d assumed that I would use trigonometry to combat this problem I just haven’t found a way yet and was wondering what you might think would work.
Current Code
local radius = self.JoyStick.Parent.Size.X.Offset / 2 -- not the best way to do this but it works
local pos = self.JoyStick.Position
self.JoyStick.Position = UDim2.new(
.5,
math.clamp(pos.X.Offset, -(radius), radius),
.5,
math.clamp(pos.Y.Offset,-(radius), radius)
) -- when the joystick is being dragged
If you need me to elaborate please tell me, and thanks a ton if you could help!