Jump to content
  • Advertisement
Sign in to follow this  
JakeM

Clamping spring velocities

This topic is 4835 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
So I guess everyone here use rock solid stable spring systems?

How to add clamping to this kind of system?

dest_velocity = initial_velocity + (src_force * dt);
dest_position = initial_position + (src_velocity * dt);

Share this post


Link to post
Share on other sites
Hi JakeM,

the problem is that your questions have been vague. There are a number of people on this forum who probably can help you, but you need to clarify what you want. Perhaps you could describe what you are actually trying to describe with these equations someone can help you.


-Josh

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by JakeM
So I guess everyone here use rock solid stable spring systems?

How to add clamping to this kind of system?

dest_velocity = initial_velocity + (src_force * dt);
dest_position = initial_position + (src_velocity * dt);


Don't use explicit Euler: update velocity, then use updated velocity to update position ("Semi-implicit Euler", similar to Verlet):

vel += force*dt;
clampedDisplacement = vel*dt;
clampedDisplacement.clampLength(MAX_DISPLACEMENT);
pos += clampedDisplacement;

Set MAX_DISPLACEMENT based on stability testing.

See also my posts on switching to a Verlet rigid position constraint at max displacement for soft-body/cloth systems (100% stable, fast, easy to implement).

Share this post


Link to post
Share on other sites
Please show small psuedo code for 10% rule? People talk about it, but they don't show how to use it.

Also how does one clamp the velocities of the objects in the direction of the spring force ?

This is the only paper on Google I found to mention the words 'clamping veloctiy':
http://www.emeyex.com/site/tuts/Springs.pdf

Share this post


Link to post
Share on other sites
Velocity in direction of spring equals veclocity dot springvector if springvector is normalized.

To clamp that, calculate the magnitude, and if it's bigger than you want, subtract some multiple of the springvector (implicitly converted to velocity) from the velocity.

However, what you really want is to use an implicit integrator, and use a little more damping in your spring system.

Share this post


Link to post
Share on other sites
Ah, the dot product! I didn't understand the notation in this equation:
dest_velocity = src_velocity - DotProduct(src_velocity, src_force_normalized) * src_force_normalized;

Quote:

Sometimes triangles are undesirably stretched or compressed by large percentages. A rule of thumb in computational mechanics is that a triangle edge should not change length by more than 10%
in a single time step, see e.g. [Caramana et al. 1998]. This can be enforced by either adaptively decreasing the time step or nonphysically decreasing the strain rate. This rule of thumb is generally used
to obtain better accuracy, as opposed to stability, and thus it is used in conjunction with implicit time stepping algorithms as well, see e.g. [Baraff and Witkin 1998].


[Edited by - JakeM on September 15, 2005 11:25:42 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!