How do I make this camera movement smoother?


I have been playing around with how I want to have my camera work in my game and have played with a few ideas that might work. The one I like the most is what this questions is about.

On a basic level, this camera works well. The only flaw I am having is that it feels a little to erratic when moving it side to side or up and down and may have something to do with how I have implemented it.

I have two layers, the base player where the world objects move and interact and a UI layer where UI objects go. For the below example, the objects are.

Base Layer: Player, Players weapon, World Objects, Player Camera (Red Box)
UI Layer: Crosshair(ui_player_crosshair), Center Of UI screen object (ui_center_point(yellow box))

  • The crosshair is set to the mouseX and mouseY position on the UI Layer.
  • The Center Of UI object is set to the middle of the screen on the UI Layer.
  • The players weapon is centered on the player and rotates towards the mouseX and mouseY position on the base layer.
  • The player camera is put around the player at a distance of Variable( and angle of players weapon with a maximum distance of 75.5.
  • Variable( / 4 is ui_player_crosshair.Distance(ui_center_point) / 4

As you can see in the video, normal use case it works pretty well but as soon as I go back and forth fast it looks quite bad.

Any thoughts/ideas would be greatly appreciated. I’d really like to use a camera that has a little movement rather then just having it statically centered on the player.


You can use lerp expression for this

Hey Ruhan,

Thank you for your comment, to be perfectly honest I had no idea what a lerp expression was (I know the basics now). I have implemented it into my camera logic and it’s much smoother now.

I still seem to be having a little bit of a stutter at the edges, but it might be due to me using the Put Object around Object2 with X angle and X distance after the camera is at it’s max allowed distance.
Any thoughts on how that can be improved?

Thank you again for the help! :slight_smile:

Did you use any Separate object event anywhere in your event? And what dose that small red cube do…

No I don’t use that condition at all in the camera logic.

The red cube is the player’s camera, normally it would be hidden but for testing purposes it helps.

The camera is centered around the red cub which uses lerp(playable_characters.X(), MouseX(, ), 15*TimeDelta()) and lerp(playable_characters.Y(), MouseY(, ), 15*TimeDelta()) to update it’s X and Y Cords.

Once the red cube is more than 45 pixels from the player character (blue ball) I use the Put Object around Object2 with X angle and X distance to keep it at that max distance.

As far I have got you didn’t use separate object event on full game? Is that right?

It’s used for player vs wall collision checks. Not sure how that would effect/change how the camera is moved when I am not colliding with anything.

Disable that event and let me know what happened after that.

Download this and install the extension with a tutorial if u dont know how to install extensions.

Download this extension: Smooth Camera.json

You’re welcome