Viewmodel Camera issues

I am having problems with viewmodel camera animation.

I have looked at these posts for help:

Non have helped

The problem I am having is the camera spins instead of staying in one place:

Any help is appriciated.

Code:

local offsetCFrame = Current_Viewmodel.PrimaryPart.CFrame:ToObjectSpace(Current_Viewmodel.FakeCamera.CFrame)
		CURRENT_CAMERA.CFrame = CURRENT_CAMERA.CFrame * CFrame.Angles(walkCycle.x / 100, 0, walkCycle.y / 6) * CFrame.Angles(recoil_x_rot.x*3, recoil_x_rot.y*24, recoil_x_rot.z / 12) * offsetCFrame
1 Like

What I did is that I put the fake camera outside the viewmodel and animated it from there which looks something like this
Viewmodelthging

Hello, if you are still having problems with the code, I advise you to check collision. My viewmodel has collision group set to “viewModel” and CanCollide false on everything, and this doesn’t happen, I tested your code, and it didn’t make my camera spin.

It’s because of the animation, I made new animations and I am experiencing the same problem. My old animations’ animated camera works fine, but when you try to change them they break, maybe because there’s too much shake? There’s more reasons

The camera has slight animation to it, meaning it isn’t too violent or not noticable. I figured out the reason recently and forgot to close the thread. Thanks anyways!

What is the solution? I am currently having the same issue

Can you share the solution? I am currently having this issue, please

Because the Cam part was attached to the HRP, and you were adjusting the HRPs position attached to the camera, when the camera would move, so would the cam part, and it would cause a chain effect of moving. A sum of it is: The Cam Part moves, the camera moves with the cam part, the viewmodel also moves with the camera, and the cam part is attached to the viewmodel, which is what causes the broken movement. To fix it have the cam part be the main bone.

Check the reply above your post.

So what should be the hierarchy of the rig? And what part should attach to the camera?

I actually figured out a few weeks ago after watching a video of someone making a viewmodel system, it turns out the hierachy wasn’t the issue and it was the code for setting the cameras rotation.

This is the code I used.

local oldCamCF = CFrame.new()

local newCamCF = viewmodel.FakeCamera.CFrame:ToObjectSpace(viewmodel.PrimaryPart.CFrame)
camera.CFrame *= newCamCF:ToObjectSpace(oldCamCF)
oldCamCF = newCamCF
3 Likes

Thank you so much! I’ve been sweeping every single forum post for a fix!

Nevermind It didnt work at all :sob:

Strange, I have my Camera bone / part attached with a Motor6D to my HumanoidRootPart, then animate it in Blender.

Strange. How did you rig it? I rigged it so that the HRP is Motor6D’ed to the camerabone, with the HRP as part 0 and the camera bone as part 1

That’s how mine is, HRP P0 & Camera Bone as P1, strange indeed.

What is the primary part of the viewmodel? And does it have a humanoid in it?

I do not use a humanoid in my viewmodels, I use AnimationController.
The primary part is the HumanoidRootPart or Your main “bone”

1 Like

Oh sad, I use a humanoid for the shirts :(.

Bummer, I make and use 3D clothing for viewmodels, it’s more realistic but thats the angle I like to go for.

1 Like