How do I rotate one camera CFrame angle relative to another CFrame angle?

image

local VerticalRecoil = 0.3
local HorizontalRecoil = 0.225 * (-1)^math.random(0,1) --Randomizes (Left/Right)
local RecoilAngle = 25 --DEGREES
CurrentCamera.CFrame *= CFrame.Angles(math.rad(VerticalRecoil), math.rad(HorizontalRecoil), 0)

Note: I simplified the code for the purpose of this question.

Adding the vertical and horizontal recoil is simple, but how do I apply a recoil angle on top of that in order to achieve an overall left or right recoil bias as illustrated in the image?

1 Like

Check out this video

https://youtu.be/h9OWnuarYuc?si=D8yd7Ldl3oo9OSMz

1 Like

Thanks, that was a great resource.

Using trigonometry resulted in much faster computation time than using fromAxisAngle with VectorToWorldSpace. It was about 14% faster over 1000 trials.