Code: Select all

```
x = x + dx * dt + 0.5 * a * dt ^ 2
dx = dx + a * dt
dx = dx + a * dt
x = x + dx * dt
```

Just wonder, how often do you use, if ever, complex motion formulas (besides box2d)? Like former vs. latter?
I suppose latter is good enough for most cases and variety of dt doesn't cause any trouble as well although it's not entirely precise and could act funny if dt goes nuts.

Code: Select all

```
x = x + dx * dt + 0.5 * a * dt ^ 2
dx = dx + a * dt
dx = dx + a * dt
x = x + dx * dt
```

One area I found the various popular physics engines lacking in was newtonian (or quasi-newtonian) movement in space. Oh I'm sure they could be used but I found it easier to write my own motion formulas so I could ignore some things like planetary gravity and angular momentum, while concentrating on the acceleration/time/position problems.raidho36 wrote:Just wonder, how often do you use, if ever, complex motion formulas (besides box2d)? Like former vs. latter?

In doing so, to avoid whacky dt problems, I simply defined a dt interval I used as my 'physics engine' step constant. I tracked the error of actual dt vs step-wise dt and inserted extra steps or skipped steps as appropriate depending on the circumstances. I found it useful to ignore excessive dt error and clamp it to one extra step insertion at most.

Lua lou aye, ah no its, lua louie

- Roland_Yonaba
- Inner party member
**Posts:**1562**Joined:**Tue Jun 21, 2011 6:08 pm**Location:**Ouagadougou (Burkina Faso)-
**Contact:**

The second method (Euler integration) is faster, simple and works for most cases.

When you really need accurate moves, and when you want to have framerate independant motion, you will have to start dealing with delta times. ANd that's how you will look into some more accurate time integration methods (Verlet, RK4, etc...).

By the way, you might find some interest in this little experiment of mine on the subject.

When you really need accurate moves, and when you want to have framerate independant motion, you will have to start dealing with delta times. ANd that's how you will look into some more accurate time integration methods (Verlet, RK4, etc...).

By the way, you might find some interest in this little experiment of mine on the subject.

Users browsing this forum: No registered users and 6 guests