Rotate part on two individual axis

I am trying to create Lumber Tycoon 2’s item rotation system, but there’s a problem…

Lumber Tycoon 2 has rotation that’s in the “space” of the camera. Creating this for each individual axis is easy, but combining them is another problem, as shown in this video:

local rot1 = CFrame.Angles(0, math.rad(leftVal - rightVal), 0)
local rot2 = CFrame.fromAxisAngle(camera.CFrame.RightVector, math.rad(backVal - frontVal)) --CFrame.Angles(math.rad(backVal - frontVal), 0, 0)
			
local rotPos = ((cameraRot * ROTATIONS GO HERE) * objHoldingOriginalCameraRot:Inverse()) * objHoldingOriginalRot

Here’s a diagram I drew to explain it a bit:

I’m not sure if I have to use quaternions, but any hint is recommended. Thanks!

1 Like