Smooth Camera Movement? How

INFO

Im trying to achieve smooth camera movements, like the smooth zoom roblox implemented, as well i have seen in @Crazyman32 AirlinerTest that hes achieved a “max rotation/angle” when in first person.
If anyone could possibly tip me off or let me know how to achieve something like this, it would be very appreciated!

VIDEO

10 Likes

TweenService is what I would use nowadays. It’s designed for this sort of thing.

6 Likes

You can try using :Lerp, :Interpolate, “for loop” or TweenService.

6 Likes

To help you get off on the right track: TweenService is not suitable for this scenario.

Unfortunately I can’t write you a detailed answer right now, but in short you will need to update the Camera’s properties every render frame to react to user input (e.g. mouse movement) and to achieve the rotation/angular clamping effect. To run your code every render frame, you should use RunService.BindToRenderStep.

12 Likes

Thank you, will update you guys with progress and questions.

3 Likes

I used a smoothing algorithm for that. It’s implemented in my game framework here.

32 Likes

I have a website I always turn to for this kind of effect. Specifically, 7. Weighted Average.

8 Likes

i still have no clue how to do this lol

1 Like

i would also like some more information on how to use this module for camera manipulation :stuck_out_tongue:

ive tried using tweenservice, interpolate and :lerp but all give jittery results. So now im looking towards smoothdamp, problem is its pretty tricky to disect.

Any help appreciated

I got it to work, but not using the module.

What i did is, to get smootened moving, you need to DAMP THE USER INPUT.

I took the default roblox camera module, and went into the code where user input, eg x,y movement is stored, and just dampened that using a simple spring module

1 Like

could you explain further? What i have is a renderstepped continuously lerping the camera to an offset of the chaaracters humanoidrootpart, lerp is pretty good however there is still some jitter here and there. looka t the video for more details.

5 Likes

How could you activate the code into your game?

2 Likes

I would also like to know how you did this, or like a tutorial

1 Like

Still need an update on what you mean by this.

1 Like

Could you please show us how you did this??

1 Like

Please show us how this was achieved! This would be a great resource for developers as there are no openly available ways to do so…

3 Likes

How, exactly would we do that?

I did it by forking the roblox camera module, and using a spring to damp the x and y values from the user inputs.

i smooth the inputs inside the ClassicCamera module,
image

this is the part of the code that updates the spring and returns the new rotateInput
image

heres the forked code, note that if roblox updates their camera code, the fork wont update, you need to manually update the code.

the code goes into starterplayerscripts
PlayerModule.rbxm (125.4 KB)

6 Likes

Cool, thanks! Once Roblox updates the camera though, I just take the new code out of the player and paste in the camera damping into ClassicCamera, right?

yeah just take the camera module from the player and add the damping code into the classic camera, though it depends on how much stuff have changed in the code.