[SOLVED] Viewmodel Camera Refusing To Work(Always anchor your viewmodel primarypart!)

camera.CameraSubject = framework.viewmodel.FakeCamera

What happens? I fall through the map into the abyss. I want to be able to follow my fake camera without falling through the map over and over again. My bullet positions will NOT be accurate if I do not follow my view model instead of my regular character. Please help so I can use my viewmodel correctly. Thank you!

1 Like

Did you change the camera type to scriptable?

3 Likes

I did that now its stuck in one place

1 Like

You could do

Camera.CameraType = “Attach”

OR

Camera.CameraType = “Follow”

Pick which one works for you and make sure the cam subject is correct

2 Likes

Follow slightly works. I fall -530 studs downwards into the void but then all of a sudden I’m just stuck there and it’s cool cus I can actually shoot without endlessly falling. The question is… how do we get it to be normal and not fall into the void at all?

1 Like

It shouldn’t be falling into the void if the fake camera is above the void. Try tracking the fake camera position while running the game

1 Like

The entire viewmodel falls into the void

1 Like

Which is why the camera is also falling. Follow keeps the subject in the Center. If the subject is falling, the camera will fall too

2 Likes

I want the view model to walk normally with my character but when I do that by setting cam subject to humanoid, the viewmodel is technically not in that position, its simply following the camera CFrame so it can look in any direction, but this makes it inaccurate for shooting bullets out of the viewmodel weapon. I dont understand what you can possibly do to fix this problem.

1 Like

I can get the bullets to be 1000% accurate, at the expense of my entire viewmodel falling into the void

1 Like

I tried anchoring the fake camera and for some reason that at least got it to where it isn’t falling through the map. Anchored causes me to fly around the map slowly instead of falling. I see you are passionate about getting solutions. If you help me fix this you get the solution. Please help

1 Like

.CameraSubject requires an Instance, which does not include other camera objects. Instead, set the camera’s CameraSubject to the viewmodel’s primary part and configure camera settings from there.

2 Likes

I really appreciate the help but unfortunately this is not the problem. I wish it were that easy. The camera settings will do nothing to fix this because we are setting our camera subject to the primary part(or fake camera part it really doesn’t matter here because that isn’t the issue), and what happens is the entire viewmodel falls through the map. The viewmodel flies around slowly when I anchor one or more of the parts inside the viewmodel. All I need help with is getting the viewmodel to move around normally without falling through the map. If anyone can come up with a solution this would not only be greatly appreciated but I think it would help other people on the dev forum as well who are having similar problems.

2 Likes

I’m still trying to figure out the intended function of what you’re trying to fix. Are you referring to a viewmodel inside a ViewportFrame? Or perhaps a viewmodel of the player holding a gun in the workspace? A video showcasing the issue would greatly help in understanding what might be going wrong.

2 Likes
2 Likes

If you’re gonna set the camera subject then don’t set the primary part cframe to the camera cframe. The follow camera type will automatically do this for you (I think)

That’s fine we don’t have to set the camera subject at all. That still doesn’t provide a solution for the viewmodel positions not aligning with the CFrame of the camera when we renderstep loop it. The only time it works is when you are focused on the primary part cframe but like I said we fall through the map

The bullets are only accurately firing from the barrel when focused on the primary part cframe of the view model. Anywhere else causes them to not fire from the correct location

1 Like
RunService.RenderStepped:Connect(function()

        for i, v in pairs(camera:GetChildren()) do

                if v:IsA("Model") then

                       v.PrimaryPart.Anchored = true

                       v:SetPrimaryPartCFrame(camera.CFrame)

                end

        end

end)

The code above is the solution. The link is to a post that contained the solution to a similar problem.

1 Like

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