applyCentralForce() in simpleUpdate or prePhysicsTick
jMonkeyEngine Hub
June 24, 2026
Hello,
I have been away for a long time mainly due to family and work, but It happened that I showed jMonkey to my kids and they found the physics demo fun and they asked me to add some features here and there.
One thing that I noticed that the physics was framerate dependent when I tried to use prePhysicsTick, but this seemed to contradict the manual. At 30FPS my objects went further and faster than at 60 FPS.
After investigating the problem I realized that using appleCentralForce() calls accumulate in the ticks and the forces are cleared only once per frame, not per tick. As it is a force, I think it is the wrong approach to multiply this by the tpf. I got the correct results by applying the force only in the simpleUpdate(), in this case my force is consistent across ticks (just like gravity). The physics run consistently and only after the update (even in parallel physics mode), divided to as many subticks as dictated by the framerate. I tested this on Win11 at 30FPS, 60FPS, 120FPS and 180FPS. Tick rate is 180, max subteps 6.
I am not sure if I am doing the wrong thing, or I read the manual incorractly, or perhaps the manual is incorrect? Anyhow I wanted to share this experience.
Discussion in the ATmosphere