Make Cam Smooth

humanoid.CameraOffset = humanoid.CameraOffset:Lerp(Vector3.new((math.cos(timeNow)/20),(math.sin(timeNow)/9)),0.25)
	
local newRot = CFrame.Angles(0,0,-math.min(deltaY,4)*1)
	
cam.CFrame = cam.CFrame:Lerp(cam.CFrame * newRot, .25) 

How can I make camera movement smooth?

3 Likes

You can try TweenService. Tween | Documentation - Roblox Creator Hub

It was difficult for me to understand at first, but i got the hang of it pretty fast.

1 Like

I tried before, it didn’t work

1 Like

What did you attempt, and how? Why didn’t it work?

You can make the movement smoother with a lower Alpha for Lerping. Your code uses quite a big Alpha for lerping (0.25, the max is 1).

That is assuming you’re using some kind of function from RunService. I’m not sure which function from there is best for camera movement, but good job using DeltaTime. That helps with a smooth camera. I also use a task.wait(deltaTime) when I moving the camera like this. Not sure if it’s needed, but yeah.

I’m using RenderStepped, I’m sure it’s the best due to the moment it is rendered.

I don’t think it’s a problem with the Alpha, because I tried with lower values.

I think there is an error with the mouse movement delta. I’m not sure

1 Like

Ah, I misread the code on multiple accounts. Could you try lowering the sensitivity of the mouse and see if that makes things “smoother”?
When looking at the documentation for the mouse delta I saw this:


If that does make things smoother, then you could try to make the delta’s close to each other by using the sensitivity of the mouse. I don’t think directly multiplying is the right answer; unsure what is.

2 Likes

well, it improved a little, I had to set the sensitivity to 0.01

I need to be able to adjust this in the code, and not in the Roblox menu

1 Like

I can’t remember the term, but I think you need use the MouseSensitivity to impact the final value of how the camera moves. Like how deltaTime is a similar value no matter the framerate. Maybe “normalizing” or “averaging”?

The mouse sensitivity can also be 0, so take that into account with an if-statement. Like, if mouseSens == 0 then ignore the calculation, and maybe set an average?

2 Likes

Yes, that’s it, I’m still testing some values, but I arrived at this

local sense = math.abs((mouseSense/mouseSense) - 1.028)

Thank you for everything.

2 Likes

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