|
![](/i/fill.gif) |
Chaps wrote:
>
> "David Buck" <dav### [at] simberon com> wrote in message
> news:3C0### [at] simberon com...
> > Do you have damping on your springs? If not, they will explode out of
> > control. The damping force is opposite in direction to the relative
> > velocity of particles at the ends of the spring. If you still have
> > problems, let me know.
>
> The algorithm I am using is this one:
> <snip>
The viscosity you are using is basically air resistance. This helps,
but you are still susceptible to exploding springs. I use the following
(in pseudo-code):
length = sqrt(dot(particle2.location, particle1.location));
undampenedStrength = (length - naturalLength) * springStrength;
normalizedVector = (particle2.location - particle1.location) / length;
if (damping != 0.0) {
relativeVelocity = particle1.velocity - particle2.velocity;
relativeNormalComponent = dot(relativeVelocity, normalizedVector);
force = (normalizedVector * undampenedStrength)
- (normalizedVector * damping * relativeNormalComponent);
}
else
force = normalizedVector * undampenedStrength;
Does that help out?
David Buck
Simberon Inc.
www.simberon.com
Post a reply to this message
|
![](/i/fill.gif) |