How to change the "end" of a circle

Why dont you try this

local RelativeDirection = (getPosition() - self.UI.CoordinateSystem.AbsolutePosition).Unit
		
		local Degrees = math.deg(math.acos(RelativeDirection.Y)) 
		if math.sign(RelativeDirection.X)  == -1 then
			Degrees = 360 - Degrees
		end
		
		
		self.UI.DisplayVector.Arrow.Position = UDim2.new(0, 50*RelativeDirection.X, 0, 50*RelativeDirection.Y) + self.UI.CoordinateSystem.Position
		self.UI.DisplayVector.Arrow.Rotation = -Degrees
		local degPerSegment = 360 / 8

		for i, v in ipairs(self.slots) do
			if Degrees <= i * degPerSegment then
				print(`selecting {i}`)
				
				break
			end
		end
		
		print(Degrees)

i think you’re confusing everyone a little bit because this a standard circle with its degrees of rotation

this thing i drew up should get you the correct angle as long as its applied correctly

code example (mightve butchered it a bit bc im just writing on devforum)

local initalpos = mouse.Position

--name the variables whatever you want

mouse:GetPropertyChangedSignal("Position"):Connect(function(currentPos)
local tanA = initialpos/currentPos
local A = math.deg(math.arctan(tanA))

print(A) --should be the final value
end)

CORRECTION: arctan(1) = 0.7ish rads, just do math.deg(math.arctan(tanA))

no arccos works here bc
u only need the adjacent side of the unit vector
and if y is negative then u subtract from 360 :3

i just wrote the most objective way i could think of it (finding the degrees of the right triangle formed between initmouse and currentmouse)

you could also just get the mod of the current angle to get the slot

i really dont know why you’re using all this math instead of using roblox’s prebuilt buttons
(simpler is almost always better)

…because thats slow

shouldnt be if you’re doing it right
what are you basing this off of

okay that changed it however its upside down now

no dude its a weapon wheel youre supposed to hover over the desired weapon…

its slower and less seamless if they have to open and click their desired weapon, and even then the buttons arent big so they might have trouble clicking

like the GTA weapon wheel

1 Like

just use guiobject.MouseEnter if you want that (fires whenever a guiObject such as a textbox or textbutton is hovered over)

again, not seamless, they have to literally hover over the button, its supposed to be a quick action they dont have the time to make sure their mouse is hovering over the button

Flip the x and y axes to whatever calculates the angle.

use 1 then instead of -1 mb that should fix it

it flipped it, if that makes sense

yea it should work now, what happened

it flipped it, like the circle goes the other direction its still in the bottom

if possible can you send another video

can you try

local RelativeDirection = (  self.UI.CoordinateSystem.AbsolutePosition-getPosition()).Unit
		
		local Degrees = math.deg(math.acos(RelativeDirection.Y)) 
		if math.sign(RelativeDirection.X)  == 1 then
			Degrees = 360 - Degrees
		end
		
		
		self.UI.DisplayVector.Arrow.Position = UDim2.new(0, 50*RelativeDirection.X, 0, 50*RelativeDirection.Y) + self.UI.CoordinateSystem.Position
		self.UI.DisplayVector.Arrow.Rotation = -Degrees
		local degPerSegment = 360 / 8

		for i, v in ipairs(self.slots) do
			if Degrees <= i * degPerSegment then
				print(`selecting {i}`)
				
				break
			end
		end
		
		print(Degrees)