So the problem is, as shown in the clip, the radar moves in a sine-wave pattern from the origin, but it’s supposed to stay centered while rotating
local Radar = script.Parent.Parent
local Trace = Radar.Trace
local Radio = Radar.Size.X.Scale/2
local pi = math.pi
local xs = 0.5
local ys = 0.5
-- Centra el trace en el medio del radar
Trace.AnchorPoint = Vector2.new(0, 0.5)
Trace.Position = UDim2.new(0.5, 0, 0.5, 0) -- punto de rotación: centro izquierdo
Trace.Size = UDim2.new(0.5, 0, 0.01, 0) -- largo medio del radar, grosor pequeño
local x = (xs/0.5) * 2 - 1
local y = ((ys-0.25)/0.5) * 2 - 1
while task.wait() do
Trace.Rotation += 1
local getx = math.cos(Trace.Rotation * pi/180)
local gety = math.sin(Trace.Rotation * pi/180)
local xi = ((getx + 1) / 2) * 0.5
local yi = ((gety + 1) / 2) * 0.5 + 0.25
Trace.Size = UDim2.new(1/2,0,0.01,0)
Trace.Position = UDim2.new(xi,0,yi,0)
Trace.Position = Trace.Position
local perimeter = 2 * pi * Trace.Size.X.Scale
local Rootation = pi/2
end
--print(perimeter)
--print(Trace.Position.Y.Scale)
--print("grade:"..math.atan(y/x) * 180/pi)
--print("grade2:"..math.atan(gety/getx) * 180/pi)
-- y x
--print(x)
--print(y)
--print("----")
--print("x: "..xi)
--print("y: "..yi)
--print(getx)
--print(gety)
--print("----")
--print(((getx + 1) / 2) * 0.5)
--print((xi/0.5) * 2 - 1)