CameraService - A New Camera for a New Roblox

In your specific case, you should be to simply call :Shake(0,0) after such condition is false, which would instantly stop it and disconnect any prior shaking mechanism.

2 Likes

This is fantastic! I came across your post a while ago and only recently have I actually had the time to implement this into a new game of mine. However, I noticed that in default FirstPerson mode, there are restrictions as to how high or low you can look. Is there any way to disable this? I’m not the best at math and don’t really understand which piece of code in the module is restricting this. Thanks in advance!

Basically, I’d like the player to be able to look straight up and straight down :slight_smile:

On lines 303 and 194 in the script, you’ll see stuff like math.rad(-25) and math.rad(25). Adjust the values to your liking! In your case, I would suggest lowering the threshold to around -8 and 8.

1 Like

I got an error when I try to use it

ReplicatedStorage.Services.CameraService:79: attempt to index nil with 'GetMouse'

Not sure if it only works on the client or the server…

The camera is something on the client-side. Thus, CameraService is client-sided.

1 Like

so I must make remote events and remote functions to use it in the server?

My apologies if I’m misunderstanding, but what’s the use-case for something like CameraService to be used on the server-side?

Each player’s camera is their own, since it’s user-input on the client-side, and the server has no control over it. You can always reference CameraService like any other module in response to .OnClientEvent or .OnClientInvoke if the server is relaying information to the client.

I want to make it so when the player falls, it shakes the camera on a script in ServerScriptService

It appears CameraService appends some bobbing motion to the HumanoidRootPart, where by default this part remains perfectly steady so as to not translate that bobbing into the camera’s viewport. Is this necessary for CameraService to function or an accidental byproduct? GUI elements like player-fixed huds are also affected by this added motion.

P.S. This is not a result of using the Shake() parameter, and I know that increasing Smoothness could help negate this issue but that would simply ignore the root issue of HumanoidRootPart shaking in the first place, not to mention adding unnecessary camera drag when moving the mouse normally.

1 Like

This might be an accidental byproduct. Do you have video or information to explain further on it?

CameraService shouldn’t be impacting the CFrame of the HumanoidRootPart, unless if the current settings on the current camera view call for the character to align with the camera’s rotation (i.e. ShiftLock). CameraService can also alter the Motor6D joints of the neck and torso if the proper settings are enabled for that.

One thing I will mention is that as of recently I have found that the Roblox client ignores the CameraMovemrnt settings unless they are set to Orbital, this is a recent regression I have noticed and I am unsure if it is still the case

Have u try PreSimulation & PreRender? a newer version of RenderStepped & Stepped also PostSimulation for a newer version of Heartbeat.

EDIT:
PreSimulation for newer version of Stepped,
PreRender for a newer version of RenderStepped & PostSimulation for a newer version of Heartbeat

1 Like

Camera becomes higher than the head; (making it look like your taller than anyone else from the camera POV) when i enable BodyVisible to true in firstperson (it also still has higher camera without BodyVisible), i tried changing the Z Offset but it only changes how far when you look down or up.
image


is there any fix for this?

1 Like

If you’re looking to change the height, you’ll want to change the Y-coordinates of the offset, as Roblox operates on Y-up, rather than Z-up!

1 Like

Great resource! I just have one small Issue. For some reason, when adjusting the smoothness property of the camera, it seems to jitter a little bit. Although this isn’t a horrible issue it is quite tedious. Is there something I can modify to fix this?

1 Like

I’m currently exploring some ways to mitigate that and will hopefully publish a patch this month. At the moment, what I would suggest is setting the Smoothness to be a bit higher (i.e. >1.5?) or to adjust it based off the player’s framerate.

how do decrease or remove that little shake while moving in shift lock?

Happy New Year! :tada:

New year, new CameraService update. :sunglasses:

Thank you to everyone who’s supported and used CameraService. I’m happy to say that across all platform it’s available, we’ve reached 500+ downloads! To those who have messaged with me on this thread and in private about your experience with it, know that I value it immensely.

This update fixes prior issues with jittery motion, the built-in shift-lock view, while also making performance-friendly adjustments behind the scenes, and a new dynamic wobbling feature!

1. Say bye-bye to the jitters.

The long-standing issue of jittery motion on some lower-performing devices has been fixed, with a combination of using PreSimulation (credits to @Eternity_Devs for the idea!) and redoing the way CameraService dampens the camera to make it look smooth. With a more simplified process, and camera motion being updated on each frame, it’s smoother and better than ever!

And to remedy the issue of choppy visuals when your player jumps up and down, CameraService now increases its dampening when players are jumping and falling, making it even more smooth.

2. Get ready to rumble (wobble).

Dynamic wobbling is here for all built-in views. Using the actual motion of your character’s legs, the screen will tilt ever so slightly to reflect your actual movements! The Wobble property is a number value, with the larger the number meaning less wobbling. However, to disable it, just set it to 0. See it in action below:

3. Minor adjustments here and there.

Hopefully, this version’s codebase is much more readable and organized for those interested. The Smoothness property values in this update will provide a different “level” of smoothness compared to before, so make sure to play around with the values if you’re upgrading. The :Shake function is also a bit more scalable to camera views with higher Smoothness now, too. In addition, the Cinematic camera view in the examples has now officially been added as a built-in camera view for you to use!

And by the way! If you’re using CameraService in your game, let me know! I’d love to link your project within the original post :slight_smile:

Thank you all again for your support. Any questions and suggestions are always appreciated!

5 Likes

hello, i’m having issues using the :Change function. could you please give an example on how you use it?

this is what I have in a localscript:

CameraService:Change(“Offset”, CFrame.new(1.5, 2, 0), false)
CameraService:Change(“AlignChar”, true, false)
CameraService:Change(“LockMouse”, true, false)

the code runs successfully, but no change is made to the player’s camera. please assist

Did you set a CameraView on the character before changing?