0
\$\begingroup\$

I used jumping real high as an example to show the jitter.

jitter

what is causing the jitter issue? I can provide code for various parts of my engine if requested.

\$\endgroup\$
7
  • \$\begingroup\$ Do you update movement/physics on a fixed timestep, while updating your camera on a variable timestep? (Note that I would not need to ask this question if your post contained a Minimal Complete Verifiable Example covering the relevant code) \$\endgroup\$
    – DMGregory
    Commented Dec 16, 2023 at 2:21
  • \$\begingroup\$ I update the camera in a update method running every 1/60s and the physics in another timed function running at 1/60s \$\endgroup\$
    – ZeunO8
    Commented Dec 16, 2023 at 2:58
  • \$\begingroup\$ At what point in the program should I be updating my camera and physics step \$\endgroup\$
    – ZeunO8
    Commented Dec 16, 2023 at 3:01
  • \$\begingroup\$ When you say a "timed function", can you show us the code you use to control that timing, and when these two 60 Hz updates happen relative to one another? \$\endgroup\$
    – DMGregory
    Commented Dec 16, 2023 at 3:23
  • \$\begingroup\$ I solved it by placing my camera update code directly after the physics step, rather than in two timed functions. \$\endgroup\$
    – ZeunO8
    Commented Dec 16, 2023 at 3:39

1 Answer 1

0
\$\begingroup\$

The jitter is caused because the two 60 Hz timer functions (camera and physics) are out of sync.

Placing the camera update code in a afterPhysicsStep function will solve the issue

fixed

\$\endgroup\$
1
  • \$\begingroup\$ I'm still wondering about the approach you're using for these "timer functions". It sounds like you might be approaching your game loop in an unusual way that could cause further timing jitter issues down the line. \$\endgroup\$
    – DMGregory
    Commented Dec 16, 2023 at 13:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .