bug: addForce() is framerate dependent #557
-
Describe the bugThe docs indicate that Is this a bug or am I misunderstanding how the physics system applies forces? VersionReplicated in both 3001.0.2 and 4000.0.0-alpha15 To Reproducekaplay({
width: 500,
height: 500,
maxFPS: 60 // Try different values for maxFPS (eg. 15 or 60) and note the different path of the ball
});
const x = add([
circle(10),
color(RED),
pos(),
area(),
body(),
]);
onUpdate(() => {
// Move right
x.move(120, 0);
// Force downwards
x.addForce(DOWN.scale(200));
}); WorkaroundIn my app I just use x.applyImpulse(DOWN.scale(200).scale(dt())); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
What exactly are you trying to do? First of all, physics runs at a fixed 50 fps, regardless of the visual fps. |
Beta Was this translation helpful? Give feedback.
It should be
onFixedUpdate()
... not sure why it isn't coming up in the documentation, the function exists...