@VegetationBush Eh, not really you can define an orientation using a Vector3 as well thatâs the concept of the BasePart.Orientation property used.
For the code sample, assuming the parts current orientation is (0,0,0) the change in position will be the same as you have noticed.
However the difference is the math that happening is actually different for CFrame multiplication vs Vector position adding which leads to some interesting properties happening as stated by the Dev reference API for CFrames.
CFrameCFrame * CFrame
Returns the composition of two CFrames.
Proceeding CFrames are offset in relative object space by preceding CFrames when multiplied together.
Notice the object space? Now try this out
local Part2 = game.Workspace:WaitForChild("Part2")
wait(5)
Part2.Position = Part2.Position + Vector3.new(0,0,1)
wait(5)
--Rotate Part2 45 degrees along it's current y axis
Part2.CFrame = Part2.CFrame * CFrame.Angles(0,math.rad(45),0)
wait(5)
--You will notice a difference here
Part2.CFrame = Part2.CFrame * CFrame(0,0,1)
You should notice that the Part2 will not move (0,0,1) along the worldâs Z axis but instead for where the partâs âRightSideâ is pointing as that is its current Z axis hence Object space.
A CFrame Value is 4 Vector3s, the first one being positions, the others being the up/right/down/lookvectors. They are the axis rotation of a part.
A good way to think of it is for an example, lets say a parts LookVector was (0, 1,0) it would mean if you placed a part 1 stud directly of the front face (which is the LookVector) it would be (0,1,0) offsetted from the original part.
Its hard to explain, but if you print a CFrame it gives you 12 numbers. The first 3 being the position, the rest determines the rotation axises.
When you do CFrame.new() it creates a new Position WITH an orientation of 0,0,0 (not in angles)
when you do Vector3.new() it just creates a new position
nah, CFrame and Position are both 3D, CFrame is the more âhardest to understand but great to useâ since it uses things like EulerAngles,CFrame.Angles,lookAt,BodyGyro,fromMatrix,fromAxis,lookVector whilst Vector3 is the âEasy to use,Great for Forcesâ since it only uses things like fromAxis,BodyMovers,Orientation and Velocity
If I had to choose, I would definitely use CFrame, since it has lookVector
A Vector3 is a position or direction in 3D space.
It can mean a position in the world, such as a partâs Position. However, a Vector3 says nothing about what way the part is facing, only where it is.
It can mean a combined direction (.unit) and a length (.magnitude), such as a partâs Velocity, or a partâs LookVector, However, it is merely a direction, and says nothing about the orientation.
A Ray is a combined position and direction. It is essentially two Vector3s in one structure. A Ray thus has an origin point, direction and length. If you wanted to make a Part that represents a Ray (such as a bullet tracer), then you would have to assume the rotation of the Part - its front surface definitely faces the Rayâs direction, but the Ray says nothing about where the top/side surfaces would be facing. CFrame.lookAt(from, to) has to make this same assumption, and assumes you want the partâs top surface to face âupwardâ by using CFrame.fromAxisAngle(direction, 0)
A CFrame (Coordinate Frame) is a combined position and orientation. It is essentially four Vector3s in one structure.
The four vectors are the position, the forward direction, the side direction and the top direction. This makes a total of 12 numbers (3*4). Compared to the Ray, it adds a side vector and a (redundant) top vector, so that the position and orientation of a 3D object can be fully represented.
CFrame.lookVector is easy access to 3 of the 12 numbers in the CFrame.
Part.Orientation is not really a position or direction, it is a best-guess representation of the orientation of a part in Euler Angles (same as CFrame:ToEulerAnglesYXZ(), which is the same as CFrame:ToOrientation()).