How to smooth out the camera

  • Hey guys,

    I'm in a bit of a pickle.

    For my camera, I'm using a simple "Every Tick" event.

    Currently. my player's speed is 120. I want to reduce it to around 80 or 90 but if I do, the camera starts stutterly very slightly.

    If I set it to 60, it's perfectly smooth, same with 120.

    If I use multiples of 60, the camera is perfectly smooth, but anything else and it's kind of stuttery.

    Any known fixes for this?

  • That depends on how you are controlling your camera....

  • That depends on how you are controlling your camera....

    I just use an Every Tick event with one action that sets the camera to the player's X and Y position.

  • Try: every tick, set scrollx to lerp(scrollx, playerx, 10*dt) and do similar for scrolly. Although it's not a totally accurate use of dt, it'll be more than adequate for smoothing out the motion of the camera.

  • Yeah you don't really have a lot of options here. Using lerp() or anything for a dragging camera will just make it worse. One "fix" is to disable pixel rounding and use high-quality fullscreen scaling...but that's kind of against the rules if making a retro game

  • Try: every tick, set scrollx to lerp(scrollx, playerx, 10*dt) and do similar for scrolly. Although it's not a totally accurate use of dt, it'll be more than adequate for smoothing out the motion of the camera.

    I did a funny thing yesterday, I think I was trying to do that but ended up doing this:

    lerp(playerx, playerx, 1 - 60^dt)

    lol

    @Tokinsom

    Would disabling pixel rounding create any bugs?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Pixel rounding is purely graphic, it will only affect how the game is displayed.

  • Yeah you don't really have a lot of options here. Using lerp() or anything for a dragging camera will just make it worse. One "fix" is to disable pixel rounding and use high-quality fullscreen scaling...but that's kind of against the rules if making a retro game

    Just tried disabling pixel rounding (fullscreen scaling was already high-quality).

    Any known side effects of disabling pixel rounding besides stuff can get drawn between pixels?

    So far it's just made the camera really smooth.

  • Pixel rounding is purely graphic, it will only affect how the game is displayed.

    Ah okay great, Thanks Aphrodite!

    My game seems a lot smoother when it's turned off. So I think I'll give my game a bit of a cheat and keep it turned off.

  • You can try MoveTo behavior to make smooth moving,also this give you the option to change the speed any time you want.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)