Advertisement

am i on the right track?

Started by March 30, 2004 11:52 AM
1 comment, last by coke_baby 20 years, 11 months ago
i have a simple physics system at the moment that uses state variables such as position, momentumm, orientation, angular momentum and their respective derivatives (ie i''ve followed david baraff''s notes on rigid body dynamics). So I can have a system of rigid bodies that all move about quite nicely, rotating as they should dependong on forces and torques that are applied to them. After placing spring forces between different bodies, I got the idea that i could link them more rigidly by doing something similar - for example to make a pin joint between two rigid bodies, I could transfer (or copy) the force acting on one body to the other, but only the component acting in the direction of the vector between the two points. Similarly a rigid link may be made by applying exactly the same force to both bodies. (and of course dealing with torque, which is another step or two down the line) Of course this won''t work properly because of mass, and I am wondering whether anyone has any advice re whether I should pursue this line of thought. So far I am thinking that I should make an adjustment to the mass of each body concerned, which shouldn''t affect the rotational properties of each body (since each has a pre-calculated inertia tensor). When I start to think about these transferred forces causing torque, I end up with a system of some sort to keep track of which bodiy is attached to which, and having to calculate the center of mass of the linked bodies...which is getting terribly like another rigid body.. I hope I''m making some sense, I''m just starting to wonder if I''m going roud in circles or not. Riptorn, I''d appreciate your advice on this because I think your ''driveable vehicle'' demo is along the lines of what I''m after - I don''t want any code snippets, just some more general concepts, paleeeese!! thanks in advance, & sorry this isn''t exactly openGL
If you have a two rigid bodies with a bar between them that links them together (a pin joint) than your physics should still be simple. If a force is applied to one of the objects, then the mass that is accelerated along the vector of the bar is the sum of the masses of the 2 objects (lets assume a weightless bar for now) however... the mass that is accelerated in the direction perpendicular to the bar''s vector is just the mass upon which the force is applied. Try it out on paper... connect two balls (in outter space perhaps) with this "pin joint bar" & apply a force on one of the balls at an angle that is 45 degrees to the bar''s vector. For every iteration following, you must take into account each of the ball''s velocity vectors (really their momentum vectors are of interest) & again... the momentum of each object along the vector of the bar must be calculated using the total mass of the two objects, however the momentum of each object along the vector perpendicular to the bar vector should be calculated with each of the respective object''s mass only, not both.

I hope that was clear as mud.
Advertisement
i kind of see what you're getting at with the bar.
i'm trying to find a way that i can keep my existing physics for the rigid bodies as they are, and add in forces or mass to compensate. I'm coming back to the idea below, that i should bring in forces that compensate for the extra mass:

say i have a pin joint and am applying the force directly along the vector of the bar, to the first mass (actually a rigid body, not a point mass) as you describe.
in order to get the second mass to move as if it were connected by the bar, i can either i can apply the same force to the second body and change the masses of both objects OR
apply a force to both the second body in the direction of the initial force as well as another force in the opposite direction to the first body, leaving both rigid bodies with the same mass.
ie: if both bodies were of the same mass, i'd end up with this:

----->F(B1)<-----F/2 XXXXBARXXX F/2------->(B2)

i think this would keep motion correct for forces applied perpindicular to the bar, as a dot product will reduce this to zero (edit: for the second mass).
does that make sense? would it work?


[edited by - coke_baby on March 30, 2004 2:35:41 PM]

This topic is closed to new replies.

Advertisement