How does fromEulerAnglesXYZ work?

I am confused as to what this line of code does:

Part.CFrame = HumanoidRootPart.CFrame * CFrame.new(0, -3.25, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(Angle), 0) * CFrame.new(0, 0, -18)

The point at which I am confused on is the CFrame.fromEulerAnglesXYZ part. I have no idea what this does and how this works in this situation.

My Angle variable will change overtime.

1 Like

This reference explains it pretty well CFrame | Roblox Creator Documentation

Basically it creates a new CFrame rotation from three angles (in radians) representing rotations around the X, Y, and Z axes respectively.

Or in other words it rotates the part.
In your context the

makes the parts position go down by 3,25 units along the y axis and the

Converts the Y axis rotation from radians to degrees using the math.rad , and rotates the parts y axis in degrees depending on the Angle variable.

6 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.