Camera Rotation

Kind of hard to explain but ill try my best;

How can I modify my current camera rotation script to make the character rotate behind the camera with a delay? Right now, when the camera turns, the character’s body follows immediately. Instead, I want the camera to be able to turn about 45 degrees in any direction, and then have the character’s body follow with that head turn but not directly on it if that makes any sense?.

It would sort of be similar to the game “bodycam” or other bodycam style games
(It’s first person, scriptable and you can see your own bodyparts)

humanoidRootPart.CFrame = CFrame.new(humanoidRootPart.CFrame.Position) * CFrame.fromOrientation(0, math.rad(cameraDirection.X), 0)```
3 Likes

Well, You may want to tween from the character hpr current rotation to the new camera angle with a small time given to complete.

While that would sort of work thats not the exact thing i’m going for, I mean so you turn your head, and once you reach the maximum turn of the head the body moves and allows you to turn more,

Turn your head 90 degrees > Continue turning but body drags behind if that makes any sense?

You’d want to check the angle between the head and character rotation and is it over a certain amount like 90 start adding the character’s rotation by the head’s delta rotation.

Got it! you can do this by:
Getting the current RootPart CFrame, then if your head/camera angle is more than to the limit (here 90 degrees) relative to the root part, then rotate the root part to the frame with rotation = camera angle - limit

Adding sometimes create an over addition resulting in a weird non-humanoid position like neck being bent 180* with laggy players.

It will be added by the delta though, not by a constant value

Keeping a constantly calculated value would be better as its not only to 1 direction tho.

1 Like

Yeah I’m not sure how you would do this in a 3 dimension rotation, you would have to involve an axis I assume

Why 3 dimensional? we only gonna rotate on Y axis.