I have a position and rotation vector that both can be changed with user input…
local position = Vector3.zero
local rotation = Vector3.zero
…that both are used as components for a part’s CFrame.
-- in some loop
part.CFrame = CFrame.new(position) * CFrame.Angles(
math.rad(rotation.X),
math.rad(rotation.Y),
math.rad(rotation.Z),
)
This is what the part looks like. The local axis are represented as parts, with the Y axis being green, the X axis being red, and the Z axis being blue.
If you multiple the rotation CFrame THEN the current CFrame, it rotates relative to the world. The problem is that it rotates around the world’s center, the 0,0,0 coordinate, instead of the model’s center! (So a car 50 studs from the center rotated 180 degrees like this would move 100 studs!) The trick is to recenter the CFrame to be rotated at the world’s center (0,0,0), do the world rotation, then move it back to the CFrame’s center.