Animated first person camera issues

I’m having some issues trying to get this animated camera to work.

It changes the movement of the camera based on the direction the camera is facing.

So far I’ve tried to use :ToObjectSpace(), :ToWorldSpace, and multiplying the offset CFrame by the camera’s CFrame. Those only seem to result in the camera either shaking rapidly or just floating around. Couldn’t find any topics of use. If you can find one, please let me know.

local camY = 0
local camX = 0
	local charSpeed = math.round(char.PrimaryPart.Velocity.Magnitude, 1)
	local thePos = vmCam.CFrame:ToObjectSpace(vmRoot.CFrame)
	local ax,ay,az = thePos:ToOrientation()
	local animOffset = CFrame.Angles(ax,ay,az)
	local camAnimOffset = CFrame.Angles(-ax,-ay,-az)
	local mdelta = inpServ:GetMouseDelta()
	local headCF = *,2,0)

	camY -= mdelta.X
	camX -= mdelta.Y
	cam.CFrame = headCF * (camAnimOffset * CFrame.Angles(0,math.rad(camY),0))
	folder.camAnchor.Weld.C0 = animOffset
	camAnchor.CFrame = cam.CFrame*offsetCF*aimCF

The camera mode is set to scriptable.

I’m not very knowledgable on this CFrame stuff and wouldn’t exactly call myself a professional developer so I have no idea what to do about this. Apologies if this isn’t very clear or concise.

1 Like

It looks the same no matter the angle? at least it looks like that to me. Could you clarify on the issue a bit more?

1 Like

I see the problem. It’s the tilt.

Somewhere, you need to convert the world-spacing rotation of that tilt and convert it into object-spacing.

1 Like

Yeah, tried it again and I have no idea what I even did differently. Works now, that’s all that matters I guess. Thanks for the response.

1 Like

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