Jump to content

Forces Affecting On Spring


warus

Recommended Posts

I write very simple physics engine for game, which basically simulate springs with mass on end of it. Main problem is to implement all forces which may affect on my mass (because for now i treat spring as object without mass, so forces don't affect on it). What i have already done is gravitation, spring constant and dumping, but it's not enough for me. I want to make it as much realistic as it is possible. So my question is - which forces i forgot to include?

 

What i know, I'm missing limit of spring length. I mean, for now if i have a spring with spring constant 1.0 N/m, length 5 cm, dumping 0.1 (forgot units) and I'll attach to it object with 10kg weight, my spring (by gravitation) will be stretched to 1 m and then it will unstretch, just like nothing happened. I want to allow situation when spring will be stretch so much, it losts it elasticity and it won't be able to oscillate. I think for now it's my main problem.

 

Also in near future i would like to treat spring as object with mass, so it brings another problem - how would gravitation affect on springs shape?

 

I hope that i made myself clear. Sorry for my bad English. Units are in SI system.

Link to comment
Share on other sites

  • 2 weeks later...

The major thing you forgot is Inertia, I guess in your game the mass moves.

 

Gravity (9.8 m/s2) and spring force (compression or depression, proportional to the change of length) should be fine. Project that on x and y axes.

 

Then apply sum(forces) = mass x acceleration and you will now what is the acceleration of your mass, on x and y axes.

 

Then integrate, delta speed = dela time x acceleraton. Use a small constant for delta time and let the computer work, compute several positions per second, display only a few of them.

Then integrate again, delta postion = delta time x speed.

 

Finally, to manage the mass on the springs, split your springs in multiple small springs, each one having a mass and a straight shape. You will probably need to add a force (a torque in fact) that tend to keep two consecutive sections aligned.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.