How would I make the camera rotate with camera part in viewmodel?

Hello. I’m making an FPS system for a private group, and the animator wanted me to add a camera part to the viewmodel so that during reloads, the camera will move around.

Problem : How do I even get started on doing this?

Heres how our viewmodels are set up:

The smaller, green square is the root part of the viewmodel. This is what gets the viewmodel to follow the camera.

The bigger red square is the camera part. It follows the root part as well, but is animated, and makes small rotational movements during the animations.

The camera is meant to rotate along with the camera part, but when I tried to do this, the camera just rotated constantly at a fast rate.
Any help is greatly appreciated!

ALSO, if anything else needs to be explained, I will try my best to answer.


I don’t know much, but I do a know a guy you can contact. Here is his discord tag: $Shelby$#8898

• Also a video of one of his creations: Example

1 Like

Oh I forgot about this post, but I’ve already found a solution.
Ill mark it incase others need it too.

I created a separate viewmodel which is just the root and camera part, and i set its origin to always be at the world origin. It copies the same animations that current viewmodel plays.

Then, I just copy the camera motions with this piece of code in a renderstepped event :

local newCamCF = CAMERA_VM.Camera.CFrame:ToObjectSpace(CAMERA_VM.Root.CFrame)
 if oldCamCF then
     local _,_,z = newCamCF:ToOrientation()
     local x,y,_ = newCamCF:ToObjectSpace(oldCamCF):ToEulerAnglesXYZ()
     camera.CFrame = camera.CFrame * CFrame.Angles(x,y, -z)

oldCamCF = newCamCF

CAMERA_VM in this case being the cloned VM with just the camera part.


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