Physics and dt

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

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?
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
User avatar
pgimeno
Party member
Posts: 3541
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: Bing [Bot] and 18 guests