# 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.

## Recommended Posts

Can someone show an example of how/where to clamp the spring veolcity in a basic spring system?

##### Share on other sites
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 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 on other sites
Quote:
 Original post by JakeMSo 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 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 on other sites
Clamp the velocity/displacement length (resize the vector).

##### Share on other sites
Ok, I guess I can't spell it out any further in simple words to what I'm looking for. :)

##### 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 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]

1. 1
2. 2
3. 3
Rutin
14
4. 4
5. 5

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633674
• Total Posts
3013277
×