What do you want to achieve?
I want the smaller circle to move smoothly along the edges of the bigger circle.
What is the issue?
Currently I made a script that prevents the smaller circle from going beyond the bigger circle. I am unsure of how to make it so that it can moves smoothly along the bigger circle. https://gyazo.com/812b8e2350f3c87ae5eb1ad325467751
The script that I’m using currently vvv
local function move()
if (Mouse.Hit.p - char.HumanoidRootPart.CFrame.p).Magnitude <= 100 then
newTS.CFrame = CFrame.new(Vector3.new(Mouse.Hit.X, char.HumanoidRootPart.Position.Y - 1, Mouse.Hit.Z))
end
newTS.Orientation = Vector3.new(0,0,90)
end
connection1 = Mouse.Move:Connect(move)
local max_distance = 10
local function move()
local vector = Mouse.Hit.p - char.HumanoidRootPart.CFrame.p
newTS.CFrame = CFrame.new(vector*math.clamp(vector.Magnitude,0,max_distance)+char.HumanoidRootPart.CFrame.p)
newTS.Orientation = Vector3.new(0,0,90)
end```
I think you would need a unit vector to control the magnitude using OwOshka’s method…
Something like…this??? Not sure…
local max_distance = 10
local function move()
local vector = Mouse.Hit.p - char.HumanoidRootPart.CFrame.p
newTS.CFrame = CFrame.new((vector/vector.Magnitude)*math.clamp(vector.Magnitude,0,max_distance)+char.HumanoidRootPart.CFrame.p)
newTS.Orientation = Vector3.new(0,0,90)
end```