Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to calculate an angle to point at a Vector3 cordinate?

How would we calculate an angle to point at a Vecotr3 Position --Specificaly to be used in a 6D motor

2 comments

0

Can you be more specific?

0

Forget the 6D motor, How would we make a part that is welded to something move so that it is angled towards a posiition

1 answer

What not many people know is that CFrame.new() has 2 arguments, one is the place where your part is pointing.

Part.CFrame = CFrame.new(Vector3.new(x, y, z), Part2.Position) -- Points part
for i,v in pairs(Model:GetChildren()) do
	if v:IsA("BasePart") then
		local Weld = Instance.new("Weld", v)
		Weld.Part0 = v
		Weld.Part1 = Part2
		Weld.C0 = v.CFrame:inverse() * Part2.CFrame --Re-welds the part, in the exact position it is now.
	end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.