|
|
> Of course, the fun part happens when objects hit each other. Then you have
> a sudden and drastic change in the forces applied. Good luck integrating
> that...
Usually in real-time simulations you can just apply an impulse to the body
and bypass the integrator altogether. Your collision response algorithm
will calculate exactly what impulse to apply to each body so that they
"bounce" realistically, you then directly modify the momentum values, and in
the next step RK4 doesn't know what happened :-)
A more accurate way is to actually simulate the contact deformation with
forces, but usually due to the big forces involved you need very small time
steps which is beyond real time simulation.
> So... well, we don't need to "estimate" the acceleration at all. We can
> compute it directly. (Assuming we have an exact position...) But you're
> saying you compute the acceleration several different times in order to
> estimate its integral or something?
By computing x' several times (which you can exactly) you are in effect
estimating x'' and x''', which gives you a better estimate for x than just
using x' alone. Remember that here "x" can be position or velocity as far
as RK4 is concerned.
> ...so you compute acceleration several times to try to estimate the
> derivative of acceleration? (I think the term is "jerk".) That makes
> slightly more sense.
Yes.
> Let us pray I never need to handle anything other than point masses...
If you have set up your RK4 code nice and object orientatedly, it is really
very simple to add in.
> Well, if you have a way to compute f(x), you could try using
You don't though, you are trying to find f(x+dt) given that you can easily
calculate f'(x).
f''(x) ~= (f'(x+dt) - f'(x)) / dt
f'''(x) ~= (f''(x+dt) - f''(x)) / dt
f''''(x) ~= (f'''(x+dt) - f'''(x)) / dt
If you substitute those expressions into the Taylor series expansion and
write it in terms of just f'(x) then you will probably end up with something
similar to RK4. Maybe :-)
f(x) = f(x) + f'(x)*dt + 1/2*f''(x)*dt^2 + ...
> Of course, now I'm trying to comprehend how this *explicit* method differs
> from the more accurate *implicit* method I keep hearing about...
You can usually rewrite your equations of motion for your whole simulation
as one big matrix equation, something like Ax + Bx' + Cx'' = D where A-D are
matrices and x is a vector of all your state variables. C would typically
contain masses and inertias, A stiffnesses, B damping and D external forces.
An implicit integrator works on this entire formula in one stab, solving
usually by matrix inversion, iterative methods or whatever. For big
interacting systems it is much better as the constraints (eg two masses
connected by a spring) are forced throughout the calculation, and not just
adjusted at the end of each time step. This is how mechanical finite
element simulation software works, essentially solving a massive matrix
equation for each time step.
Post a reply to this message
|
|