Physics and dt

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
togFox
Party member
Posts: 148
Joined: Sat Jan 30, 2021 9:46 am

Physics and dt

Post by togFox »

I will be using the physics engine in my next project and thought I'd check:

Code: Select all

Person[i].body:applyForce(intendedxforce,intendedyforce)
The applyForce method - should that be scaled by dt?

Code: Select all

Person[i].body:applyForce(intendedxforce * dt ,intendedyforce * dt)
?

I mean, is applyForce the force at any given time, meaning dt is irrelevant, or is applyForce the force per second in which case, dt becomes important?
User avatar
pgimeno
Party member
Posts: 2596
Joined: Sun Oct 18, 2015 2:58 pm

Re: Physics and dt

Post by pgimeno »

The force applied by applyForce should not be multiplied by dt in principle. It lasts the duration of dt that you pass to world:update(); if you want it to be applied for longer, you have to apply it multiple times.
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests