Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to use CFrame to point an object at another?

Asked by 9 years ago

I just want to know how I can use CFrame to make a part point at another part. I tried to use this line of code I found on the wiki:

Workspace.Part.CFrame = CFrame.new(Workspace.Part.Position, Vector3.new(0, 75, 75))

But it doesn't really point at something, and more or less just angles the part in a really strange way that I can't explain. I've read through the CFrame article on the wiki to see if there were any other methods I could do, but nothing has worked so far.

1 answer

Log in to vote
0
Answered by 9 years ago

Never mind, figured it out after a bit more fidgeting. Instead of using the above code exactly, I did:

Workspace.Part.CFrame = CFrame.new(Workspace.Part.Position, Workspace.Part2.Position)

This will keep the part where it is while orienting its front face towards the designated part (Part2).

Ad

Answer this question