.trying to make a viewmodel for a game, however it kinda works but only rotates to one position

lol im not a cframe expert, this took me 1 hour, still no solution
I want to make it so the Viewmodel is attached to the player’s camera with positioning offset, been struggling since I don’t know a lot about CFrame

viewmodel.HumanoidRootPart.CFrame = CFrame.new(cam.CFrame.X, cam.CFrame.Y - 1.5, cam.CFrame.Z) * CFrame.Angles(math.rad(cam.CFrame.LookVector.X), math.rad(cam.CFrame.LookVector.Y), math.rad(cam.CFrame.LookVector.Z))

Do you have this in a loop?
RunService (recommended)

this is inside RenderStepped

positioning works but not rotation

Setting the ViewModels PrimaryPart (in this case, HumanoidRootPart) to your Camera CFrame should work.

viewmodel.HumanoidRootPart.CFrame = camera.CFrame

“trying to add offset so the camera is supposedly in the head’s position without tilting”
the fact is, I’m making this so It reuses animations from the character to the ViewModel and a lot of them include headtilting making the ViewModel go sideways

Sorry but I don’t understand what you mean, an animation is making your ViewModel turn sideways? I’m not exactly sure how to help you.

gonna try to explain how it should work since I’m kinda bad at clarity lol
when I use the camera as HumanoidRootPart (w/ “offset”), the hands are over the camera
trying to use offset on the HRP works, but the main problem is that the models don’t rotate since I’m not sure how to get ONLY the rotation of the camera

Are you locking the camera into first person?

leave that as a “yes” since this is a first person viewmodel

GOT IT FIXED LOL
WHY DID I WASTE MY ENTIRE TIME DOING THIS LMAO

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