How would I offset the camera if my camera subject isn't a humanoid?

Hello! The Humanoid object that is part of the player’s character has a property called CameraOffset. This lets you offset the camera by a vector3 value which is very useful. I am just wondering how this could be achieved without having the subject of the camera set as a humanoid.

1 Like

Hello there !

While you are in studio Play Mode, there is a script in Players > You > PlayerScript > PlayerModule > CameraModule.
Copy the PlayerModule and the PlayerScriptsLoader, leave the Play Mode, then paste them into your StarterPlayerScript.
Now open the CameraModule, and go to the line 500 and half, there is a function called “Update”.
At the bottom of this function, you can add this following line of code.

self.activeCameraController:SetCameraOffset(Vector3.new(2, 0.25, 0))

Not sure if this still work as it was a old thing i was doing some years ago :sweat_smile:, i’m going to check it

Edit:
Alright, so it work by forcing mouse lock and setting up the lock camera offset but other than this i don’t know any solutions as the camera offset was mainly made only to support humanoids.
So you probably have to set up the camera to scriptable and made it by yourself i guess.

self.activeCameraController:SetIsMouseLocked(true)
self.activeCameraController:SetMouseLockOffset(Vector3.new(2, 0.25, 0))

Thank you for the really helpful response!

Sadly this makes you unable to use autorotate which is something I need.
Luckily I was able to find the exact line where they add the cameraoffset from the players humanoid.
It’s located at PlayerModule → CameraModule → BaseCamera
All I had to do then was add my offset as a vector3 value on following Lines:
280
result = bodyPartToFollow.CFrame*CFrame.new(heightOffset + humanoid.CameraOffset)
424
result = bodyPartToFollow.CFrame.p + bodyPartToFollow.CFrame:vectorToWorldSpace(heightOffset + humanoid.CameraOffset)

Thank you for the help nonetheless.

4 Likes

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