Cframe question

I see many people using the multiplication symbol when using Cframe, but they never speak for what it is for and when we need to use it.

game.Workspace.Block.Cframe = Cframe.new(10,10,10) * [[here]] Cframe.Angles(math.rad(90),0,0))

Multiplying CFrames is essentailly adding their Positions and Rotations together.

CFrame.new(2, 5, 0) * CFrame.new(0, 5, 1)

results into a CFrame with 2, 10, 1 as a position, and 0, 0, 0 as a Rotation, because both CFrames don’t have any rotations set (multiplying with CFrame.Angles)

CFrame.Angles(0, math.rad(90), 0) * CFrame.Angles(math.rad(180), 0, 0)

results into a CFrame with 0, 0, 0 as a position, because the CFrame.Angles constructor just initiates the rotation part, and a rotation of 180, 90, 0 (in reality it’s in radians).

CFrame.new(1, 1, 2) * CFrame.Angles(0, math.rad(90), 0)

results into a CFrame with 1, 1, 2 as a position, and 0, 90, 0 as a rotation.

3 Likes

That was really helpful, thanks :wink:

1 Like