torque due to gravity

Started by
12 comments, last by grhodes_at_work 19 years, 3 months ago
Thank you for the explanation.

I found this in your post history (I wish search was working, manually going through posting histories is a royal pain)- could you explain this further?
Quote:The way a damper works is this:

Damper Force = -cv

where c is the damping factor and v is the velocity component of the object parallel to the damper and measured relative to the other end of the damper and . For example, if the damper is connected to objects O1 and O2, with velocities V1 and V2 (measured in world space), and the direction of the damper is D, the damping forces applied are:

Damping Force on O1 = -c((V1 - V2) dot D)
Damping Force on O2 = -c((V2 - V1) dot D)


Namely, is D in the opposite direction of the normalized spring force? I assume I will also have to take account the linear velocity as well as the angular velocity when making this calculation?
Advertisement
Quote:Original post by thedustbustr
Thank you for the explanation.

I found this in your post history (I wish search was working, manually going through posting histories is a royal pain)- could you explain this further?


I wish search were working also. You can use google to search gamedev.net, but, as you way, it is currently a royal pain. I'm not sure what the status of search is.

From my old post, in general the damper and spring may not be colinear---might be connected to different points. But, since they often go together (even in real life----think of automobile shocks) its easiest to treat them as colinear with the same endpoints. That said, D is a unit vector in the direction from the point on O1 to the point on O2 where the spring/damper is connected.

So, then, D is defined purely in terms of geometry and has absolutely nothing to do with the spring force (a spring/damper aligned with the x axis will have exactly the same D regardless of whether the spring is at its rest length, or is compressed or stretched).

And, yes, you have to find the actual velocity at the points on O1 and O2 where the spring/damper is connected, which means you have to include center-of-mass translational velocity plus the kinematic increment due to rotation.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
This is what I came up with, but it seems not to have any effect. Is this right? [edit]OK< if I jack the constant up to 1000, it pushes the springs into a square shape with the masses at the corners... not exactly the effect I wanted.

void Spring::tick(double dt){        vector3 dxv=(b->world_position() - a->world_position()); //direction of force on a by b    double dx=dxv.length()-N;    vector3 F = k*dx*Normalized(dxv);    //Grhodes_at_work    //Damping Force on O1 = -c((V1 - V2) dot D)    //Damping Force on O2 = -c((V2 - V1) dot D)    vector3 va = a->parent->v + CrossProduct( a->parent->w, (a->o - a->parent->cm->o) );    vector3 vb = b->parent->v + CrossProduct( b->parent->w, (b->o - b->parent->cm->o) );    vector3 Fd = -.5 * DotProduct( (va - vb), Normalized(a->o - b->o) ) * Normalized(F);    F += Fd;    a->F += F;    b->F += -F;}
No, that's not correct. Do not use Normalized(F) since Normalized(F) still carries the sign of the spring force, which you do NOT want (Normalized(F) might point in the opposite direction as D, which'd put the sign on damping wrong). I guess my original post didn't have the final vector eqn for damping force. Here's what you want instead:

Vector3 D = Normalized(b->o - a->o);vector3 Fd = -.5 * DotProduct( (va - vb), D) * D;


[Note I reversed the order of the *->o items in Normalized() for consistency with my previous, though it really doesn't matter whether you have (b->o - a->o) or (a->o - b->o) since the sign of that vector cancels out]

Then, a->F += Fd and b->F -= Fd;

Also, you've got some parent stuff in there. You need to make sure that your kinematic velocity at the point of connection of the spring/damper is represented in world coordinates for both objects....
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net

This topic is closed to new replies.

Advertisement