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

This CFrame and Vector3 are starting to really confuse me, help?

Asked by 5 years ago

Alright, so the definition of Cframe.new(Vector3) is this: Creates a CFrame from a Vector3

Which confuses me because aren't both CFrame and Vector3 just simply the coordinates of a part? Like wouldn't that description jut be saying: Creates a position from a position Which really confuses me.

1 answer

Log in to vote
1
Answered by 5 years ago

A Vector3 is a location with x, y and z coordinates.

For example, a part has a position of (1,0,3), so you know where it is located but you have no clue about how it is rotated or oriented.

CFrames are locations with orientations. So if you wanted to set the orientation of an object, you'd have to use CFrames.

What you said about CFrame.new(Vector3) is creating a CFrame at that position with a standard rotation. If you wanted to have a part CFramed to look at another part, you would do part.Position = CFrame.new(part.Position,lookAtPart.Position)

Another difference is that when you move a part to another part's exact location with position, it will go above it so that they don't intersect, but when you do it with CFrame, they will both be in the exact same position even if they intersect.

Ad

Answer this question