Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
1

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

Asked by 2 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.

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

0
Can you be more specific? Monsieur_Robert 338 — 2y
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 Wafflecow321 361 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

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
Ad

Answer this question