bouncing steel

Started by
15 comments, last by Viper173 19 years, 6 months ago
I'm currently trying to implement a spring system (I guess it's called). Where point A is connected to point B and force is being applied when the distance between them changes. then the velocity of the masses A and B is calculated with help of those forces. and finally the position gets added to the velocity. that's a spring system, isn't it? anyways, I thought you could simulate every material property with this kind of approach. but steel did come out kind of bouncy. the distance between the masses should stay almost constant when we are talking about solid materials but its getting much smaller or bigger. when I apply a force on point A how should B (which is connented to A) deal with it? well, if the original dist was 0.5 : Applied force = l (A.position - B.position) l + 0.5 vel[1] := vel[1] + AppliedForce[1]/Mass ; vel[2] := vel[2] + AppliedForce[2]/Mass ; vel[3] := vel[3] + AppliedForce[3]/Mass ; now friction could lower the vel after being added to the position. still, ...bouncy. do you know a better approach?
Advertisement
it does seem a good idea to model metals with spring at first glance: after all that kind of how these materials work on the molecular level.

however, in order to simulate a stiff material, you are going to need stiff springs. springs with such stiffness have a very high frequency. VERY high. since youre updating at a couple a hundred of times a second at most, there is no way for you to integrate such stiff springs. if you tried to make such a stiff spring, and only updated with such big timesteps, bad things will happen to your simulation.

now you can apply a more advanced integration scheme, and be able to take bigger timesteps without problems, but you wont get anywhere near simulating the stiffness of steel. youll need another method for that.

you could try FEM (finite element method), but im affraid its over your head, as are LCP's (linear contraint problems). even somewhat realisticly simulating the internal dynamics of stiff materials is just very hard.
maybe I didn't quite understand the idea why rubber is flexible and steel is not.
the system works fine as a rubber rope.
I'm not sure whether it works with steel too since A can't get away from B anyway.
whatever, I thought something like a dampening coefficient could take care of it. But how and where?

thanx
ooo, haven't read your post yet, Eelco.

well, what do you suggest then?
I'm not willing to put that much afford in my simulation.
I mean I am ok with steel bouncing and bending just a little, I just wanted to know how you could lower this bouncy property to a minimum. It's got to be possible.
I'm updating 100 times a second by the way.
well, its a really long subject, so im not going to be able to tell you everything about it, but ill leave some pointers for what to search for.

simulating stiff springs is hard because... well picture for graph of a quickly oscilating mass. what your integrator does is getting the derivative of this graph, and extrapolate that to obtain a new position. this is called an explicit method, and yours explicit euler. this works for small timesteps, but becomes increasingly inaccurate and even unstable (everything begins to jump around uncontrollably) for larger timesteps compared with respect to the peroid of oscilation. i cant really explain why without a picture, but maybe you can visualize it in your head.

a commonly used intergration method for mass-spring systems is called verlet integration. it suffers from the same symptoms, since its also an explicit method but MUCH less so than your euler method you use now. i think this is your best bet.

there are tons of other methods for this, also a whole bunch of implicit methods, which are less accurate but allow for larger timesteps without instability.

if you search for verlet mass spring or something like that, youre bound to find a good explanation of the verlet integration scheme, and its quite understandable.

also, make sure to optimize your maths, since if you can do things faster, you can do them more often with smaller timesteps and be able to simulate stiffer material correctly.
geee, I didn't expect it to become that complex. Well, ok actually I did. I was worried about having to use derivatives and stuff...

thanx anyways. I 'll go looking after your keyword in google.

actually I just put together a small structure that holds up on its own and lightens the stressed supports more red. lookes ok for a start. seems like the euler method isn't so bad after all.
AND EASY TO UNDERSTAND!
oh yes euler isnt too bad for simulating structures made of beams of steel. still not perfect, but since a complete stucture actually quite capable of deforming aswell it isnt as big an issue here.

i thought you wanted to model a piece of metal with a bunch of springs, instead of a structure with a bunch of strings. quit ea difference, but nonetheless all what i said above still stands.

still euler wont bring you very close to the true stiffness of a metal bridge for example, but much moreso than it brings you to the stiffness of a single beam of metal. its still worthwhile to look into verlet, itsnot that hard really.
Quote:Original post by Eelco
oh yes euler isnt too bad for simulating structures made of beams of steel. still not perfect, but since a complete stucture actually quite capable of deforming aswell it isnt as big an issue here.


Actually, its DAMNED bad! Simple (explicit) Euler, which is what Viper173 is using---at least for his velocity update, is unconditionally UNSTABLE for simulating problems with springs of any stiffness, unless you add damping. Which Viper173 has not done. The higher the stiffness, the worse the problem. And steel is pretty stiff. Even with damping, Euler is not as stable as other methods. The Runge-Kutta methods are stable for springs with no damping added. Verlet also is far better than simple Euler. See my paper from the Game Developer Conference archives in 2001 for more details, available at Game Developer's Conference

The only reason Viper*'s simulation isn't blowing up is because, it would seem, he is updating the position *after* velocity, which means his position update is NOT simple Euler anymore (simple Euler would have to use the old, pre-updated velocity). So in reality his integration is only half simple Euler.

The implicit methods are the most stable, but also the most difficult to understand and implement.

(Also, minor point, notice that Euler is capitalized, since it is a person's name.)
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
Yes, grhodes_at_work.

that's what I experienced. the higher I wanna make stiffness the weirder my structure behaves.
I took a look at your paper, but ... well, puhhh. I guess I have to get back to it and read it more closely.

Am I so wrong with my approach?

Take a look at my simple simulation so far:

http://www.geocities.com/viper1732002

and then 'physics.zip'

It looks good in my opinion. Now, my goal is to make it less flexible.
Are you telling me there is no way to achieve that without implementing an entirely different approach?
What about that dampening? where does it belong?

I feel I'm so close to my goal, so I'm a little contra new ideas of how to do it. just a little less flexible. that's all






This topic is closed to new replies.

Advertisement