No announcement yet.

Camera lag/stutter - how to fix?

  • Filter
  • Time
  • Show
Clear All
new posts

    Camera lag/stutter - how to fix?

    Hello! In the name of practice, I started working on a side-scroller timing game like "The Impossible Game". I can't seem to wrap my head around why, but for some reason the camera is noticeably laggy and stutters frequently in-game. It's not terrible at all, but it's definitely felt, especially in a timing game. It's always random and I kept my eye on the framerate and it was always fine. Not only that but it was just the movement that seemed laggy; if I kept my eye fixed on the player himself, there was no lag in his animation (which would have been noticeable if it was normal lag).

    Just a visual aid, obviously you're not gonna be able to tell from a gif @ 25fps:

    For this game, the player's character spins whenever you jump. Therefore I can't have the camera stuck to the actual cube, because then the camera would flip with the character every time you jump. Since neither the spring arm nor the camera can have rotation restraints (that I know of at least, if there's an alternative please let me know), I ended up doing it manually like this:

    (event tick)
    Click image for larger version

Name:	oJNv0Ec.png
Views:	1
Size:	129.5 KB
ID:	1205338

    So every tick, the camera's position in the y axis would be updated to match the player's+500 (so it's moved to the right), and it would just take its original x and z to remain the same. I thought this could be it so I removed it but the stutter was still noticeable even if the camera was left attached directly to the player. I tried setting up different locked framerates to see if that affected anything but it didn't. I also tried playing the game after packaging it with different settings (from dev to shipping, low quality settings to high quality settings) and the lag still persisted. It *has* to be the camera.

    Any clues? Thank you!
    Last edited by jfaztk; 01-12-2017, 08:55 PM.

    Same here, i look from another player and i can see the other player moving smooth, but from the player pov it jitter


      You can have the camera attached to your player and not have it do all the rotations. Theres three tick boxes in the spring arm settings. Inherit yaw. Inherit pitch and inherit roll. Just untick them then the camera will follow your player and not rotate when your character rotates.

      Edit: thinking about it sounds like you dont have a springarm. Add a springarm component to your pawn, make it child of static mesh of your pawn.

      then add a camera component and make that a child of the springarm
      Last edited by savagebeasty; 05-21-2019, 05:30 PM.