RK4 - absolute time value t

Started by
6 comments, last by MGB 18 years, 8 months ago
Hi all, I'm having problems understanding the fundamental restructuring of my code moving from Euler to RK4. Looking at Glenn Fielder's stuff he uses an absolute time value 't' which doesn't correspond to my simulation that works with time increments 'dt' only. Also, how do external forces get applied here? I'm thinking I accumulate the linear and torque forces as normal and apply them in the forces method too - but how/do I factor in the absolute 't' here as well?! /confused...
Advertisement
You have an implicit absolute t in your simulator. it's good to keep track of t anyway: t += dt; each step.

call your current state time t
the next state will be t + dt

you only need the t when you have time dependent forces. i have not read that article. hope this helps a bit.
Quote:Original post by Airoyou only need the t when you have time dependent forces.


Ah that makes sense. I presume accumulated forces are applied in the normal way...
...or maybe not.

Hmm: in my system a 1Kg object is falling at 9.8m/s after 1 second, which is ok.
A 2Kg object is falling at 5m/s after a second = bad.

I'm applying gravity as an external force - I have a feeling I'm applying the accumulated (external) forces incorrectly here - any pointers on how these are applied?

[Edited by - Aph3x on August 12, 2005 8:27:49 AM]
This article was what I used as a reference for RK4... with a little help from Airo, et al. :)

The acceleration function in the accompanying source is where forces are applied. ie: return -9.81f; // gravity
ah, did you mean this one?

That's what I've been using so far; the problem I have is how to apply external forces in the acceleration function (which in the tutorial only applies 'internal'/generated forces there).
By 'external' forces I mean those accumulated over the frame.
Quote:Original post by Aph3x
...or maybe not.

Hmm: in my system a 1Kg object is falling at 9.8m/s after 1 second, which is ok.
A 2Kg object is falling at 5m/s after a second = bad.

I'm applying gravity as an external force - I have a feeling I'm applying the accumulated (external) forces incorrectly here - any pointers on how these are applied?

gravity force=g*mass
Most likely you just forgot multiply, and have 2kg mass thing that have weight force as on 1kg.
rofl - sometimes you concentrate so hard on new details you forget the basic stuff.
:o
thanks Dmytry

This topic is closed to new replies.

Advertisement