ToWorldSpace converting to local space instead

I’m having this issue where I’m trying to rotate a camera around in the world space like this:


(Rotated in studio using world space)

However when I apply the rotation to it’s CFrame using the “ToWorldSpace” function

camera.CFrame = camera.CFrame:ToWorldSpace(CFrame.fromEulerAnglesYXZ(0, 0, math.rad(-1))

it instead rotates in it’s local space., looking like this:


(Rotated in studio using local space)

Can anyone explain why this happens? I’ve read the docs and other posts many times but I just can’t seem to get the hang of it. It feels very counterintuitive.

I find it interesting how you seem to overcomplicate it.

Does this achieve what you’re looking to do?

camera.CFrame *= CFrame.Angles(0, math.rad(-1), 0)

Funnily enough, your approach achieved the exact same result as using the ToWorldSpace function, so unfortunately not.

Try doing this weird thing instead reversing the order.

camera.CFrame =(CFrame.fromEulerAnglesYXZ(0, 0, math.rad(-1))* camera.CFrame).Rotation + camera.CFrame.Position

2 Likes