Angular spring damping

Please don't post Bullet support questions here, use the above forums instead.
Post Reply
h4tt3n
Posts: 25
Joined: Wed Mar 12, 2008 9:08 am

Angular spring damping

Post by h4tt3n »

Hello everyone,

I've been working a lot with linear and angular springs, and during this work a simple yet hard-to-solve problem has occured, and I hope that you might be able to help me...

When simulating springs it is very helpful to ad a velocity dependant damper. The one I use looks like this (in 2D):

Image

linear damping force = -Kd * ((V.x*L.x+V.y*L.y) /|L|)

where Kd is the damping coefficient, V is velocity vector, L is spring vector, and |L| is spring length. Now, it is very tempting to add a similar angular or normal damping in the form of:

angular damping force = -Ka * ((V.x*L.y-V.y*L.x) /|L|)

Where Ka is the angular damping coefficient. This works fine in the sense that it makes wobbly soft bodies act much more like bags of oil or even sand, and it makes rows of connected point masses and springs behave much more like a real rope or chain.

The trouble is that the angular damping (as opposed to the linear damping) is not a strictly internal force. When applied to a free falling soft body it also dampens its movement as if under influence of air drag, and angular damped ropes stop swinging much faster than undamped ones.

I apply the angular damper pairwise for each set of endpoint masses at a time, and in opposite directions, so it should act as an internal force.

So, the big question is: How do you implement a strictly internal angular damping force?

Cheers Michael
Last edited by h4tt3n on Wed Mar 12, 2008 7:35 pm, edited 1 time in total.
DannyChapman
Posts: 84
Joined: Sun Jan 07, 2007 4:29 pm
Location: Oxford, England
Contact:

Re: Angular spring damping

Post by DannyChapman »

Make it apply to the angle between 3 points - so if you have three points A-B-C then whatever force you apply to C, you apply to A in the opposite direction. In fact, you could actually distribute the "opposing" force over multiple other points.
h4tt3n
Posts: 25
Joined: Wed Mar 12, 2008 9:08 am

Re: Angular spring damping

Post by h4tt3n »

DannyChapman wrote:Make it apply to the angle between 3 points - so if you have three points A-B-C then whatever force you apply to C, you apply to A in the opposite direction. In fact, you could actually distribute the "opposing" force over multiple other points.
I already do something very similar to this. Damping force is calculated for each spring at a time and applied pairwise in opposite directions to the endpoint masses of that spring. So it should act as an internal force. Trust me, I only ask here because I have tried so many methods, and none of them eliminated the external drag effect.

Do you know of any other similar methods? I suppose the problem must have been solved, since angular damping is such a versatile tool.

Cheers
Nathanael
Posts: 78
Joined: Mon Nov 13, 2006 1:44 am

Re: Angular spring damping

Post by Nathanael »

You may be interested in reading that paper http://www.matthiasmueller.info/publica ... sedDyn.pdf.
Two things in there could be of interest to you,
- A global damping method.
- A bending (angular) constraint.
Mind that the proposed solutions in the paper work a position level and in 3d.

Hope it help.
DannyChapman
Posts: 84
Joined: Sun Jan 07, 2007 4:29 pm
Location: Oxford, England
Contact:

Re: Angular spring damping

Post by DannyChapman »

DannyChapman wrote:Make it apply to the angle between 3 points - so if you have three points A-B-C then whatever force you apply to C, you apply to A in the opposite direction. In fact, you could actually distribute the "opposing" force over multiple other points.
I realised later this is wrong :oops: as it does introduce world torque.

If you want to apply damp angles between masses in a system by just applying forces you can do this:

Image

So if you want to apply a torque T at point B to points A and C then you can calculate the forces F1 and F2 such that:

* You apply F1 to mass A and -F1 to mass B - introducing a world torque of -2*|F1|*d1

* You apply F2 to mass C and -F2 to mass B - introducing a world torque of 2*|F2|*d1

and you calculate F1 and F2 using:

2*|F1|*d1 + 2*|F2|*d2 = T (the total torque is what you want)

and

|F1|*d1 = |F2|*d2 (the world torque on pair A-B cancels out the world torque on pair B-C)

This should conserve the system's angular and linear momentum. Hope it's clear. Hope it's correct this time!
h4tt3n
Posts: 25
Joined: Wed Mar 12, 2008 9:08 am

Re: Angular spring damping

Post by h4tt3n »

@Nathanael

Thanks for posting the link to that paper. I'm quite tempted to "convert" into making position based simulations after giving it a glance or two. I found the damper you mentioned and have tried to implement it. Lines (1) to (5) were no problem to convert into a 2D frame, but I find it hard to understand lines (7) and (8), and it is even harder to convert them into a newtonian system with force, acceleration, velocity and position.

So far the damper slows down everything - very efficiently - but sadly also angular velocity, which it was supposed to leave unchanged.

Do you happen to have a hint or two as to how this might work in a conventional newtonian simulation?

@DannyChapman

Thank you for the detailed explanation! I must admit this looks suspiciously much like a number of the countless methods I've already tried. But there are a few differences I'd like to know more about:

Why do you calculate torque, when your solution seems to be entirely force-based? Do you change the angular momentum of the entire system later to counter damping of angular velocity? Can I ask you to perhaps explain the damping process in detail?

Cheers Michael :-)
Nathanael
Posts: 78
Joined: Mon Nov 13, 2006 1:44 am

Re: Angular spring damping

Post by Nathanael »

If we reduce the problem to just two points,
Let Xa,Xb be points position of A and B resp.,
Let Va,Vb be points velocity of A and B resp.,
Set Vr=Vb-Va, to be the relative velocity
Set N=(Xb-Xa)/|Xb-Xa|, to be the direction from Xa toward Xb
We can now project Vr unto a plane perpendicular to N and damp it,
Set Pv=(Vr-N*(Vr.N))*AngularDamping,
Then apply that impulse to Va and Vb,
Va'=Va+Pv*(Mb/(Ma+Mb))
Vb'=Vb-Pv*(Ma/(Ma+Mb))
That converse linear momentum,but remove the angular one when 'AngularDamping' is set to 1.
Post Reply