Some Rigid Body Problems/Questions

Started by
5 comments, last by Hybrid 20 years ago
Hi, I''m trying to simulate an articulated lorry, using two rigid bodies and a joint between them. Though I have a few questions that have appeared as I got into the project. 1. Rigid bodies tend to rotate about their centre of mass. Now when the cab acts on the trailer of the lorry, then the trailer actually rotates about the axis where the rear wheels are, not its centre of mass. How can I cause it to rotate about the rear wheel positions instead of the centre of mass? Do I need to apply a force at the rear wheels to cause this? How do I calculate it? 2. I''m going to use an impulse force for the joint, to keep the two rigid bodies together. When do you apply impulse forces in the update function. Do you just add it to all the other forces like normal. Or do you have to add it after you have calculated the updated velocities and momentums etc.? Thanks for any help!
Advertisement
quote:Original post by Hybrid
1. Rigid bodies tend to rotate about their centre of mass. Now when the cab acts on the trailer of the lorry, then the trailer actually rotates about the axis where the rear wheels are, not its centre of mass. How can I cause it to rotate about the rear wheel positions instead of the centre of mass? Do I need to apply a force at the rear wheels to cause this? How do I calculate it?


The friction force applied on tye lorry by the wheels does in fact result in the turning about the wheel/road contact point.

quote:Original post by Hybrid
2. I''m going to use an impulse force for the joint, to keep the two rigid bodies together. When do you apply impulse forces in the update function. Do you just add it to all the other forces like normal. Or do you have to add it after you have calculated the updated velocities and momentums etc.?


Impulse force may give you some numerical instability, so you''d better be using at least something like Runge-Kutta for integration. Verlet may be okay. Euler will suck fast.

This depends on the integration technique, but since the impulse force is coupled with position, and (maybe) velocity, you''re probably going to just add it along with all the other forces, and calculate it based on the prior time step''s state. To update the state then calc and add the impulse would mean either: a) don''t use the calculated impulse until the next time step, which at that point will mean it was calc''d based on the prior time step; or b) use an implicit integration technique, and you''re probably not advanced enough to do that yet.



Graham Rhodes
Principal Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
Thanks for the reply. Exactly what I needed to hear
I don''t get this - the first part. It''s been bugging me for ages - I''ve used baraff''s papers to get my rigid body stuff semi working. Which are frictionless btw. But all the rigid body rotation stuff is based on rotations about the center of mass - how can you possibly have a rotation about the wheels'' point of contact?
I know it''s correct, but for example if a car''s front right tire hits an immovable object whilst in motion, shouldn''t the whole car rotate about that tire? all the rotations I have are about the c.o.m, so how do I deal with this? I can see that you could *nearly* achieve this by both rotating about the c.o.m and translating the car in a certain way - is this the way fowards?
An insightful question, actually. I'll try to shed some light, but feel free to ask further questions if the point I'm trying to make doesn't snap into place! (Because I'm going to ramble for a while!)

First point. Rotation is about COM within the object's local coordinate space , but....since the COM itself can also move relative to the surrounding world, it is possible to cause rotation about an arbitrary world point just by applying the right forces. And this is how it works. The COM is just a reference point for calcs, and the object rotates about the COM within its own local coordinate space . But the COM (or other reference point) moves relative to the world give an effective rotation about a different point in the world.

OK. So, the reason physics calcs are done about the center-of-mass is for convenience and convenience alone. The equations become simpler, e.g., the translation equations become decoupled from the rotation equations, which makes time-stepping much, much easier. But, you don't actually have to do the calcs about center-of-mass. In reality, the motion is a combination of translation and rotation. You can choose any point in space---not even within the body---to be your center/reference point for the calcs. You just have to be sure you calculate your torques correctly about the point you choose, and you have to make sure your inertia matrix is calculated at the point you choose. (Its fairly simple to take an inertia matrix calculated at COM and transform it to any other point in space.) Get the forces, torques, and inertias right, including constraints, and the body will move correctly. REGARDLESS of the point you chose to do your calcs at!

That said, there is not usually a good reason to choose any point other than COM for calcs. EVEN IF there is a case where the rotation really will be about a different point. Here is why. First, you don't necessarily know a priori which point is the real point of rotation in world space. Second, it all works out in the end anyway. If you get all the torques/forces correct, then the body will rotate about the COM (you always treat rotation as happening about the reference point), but...to reiterate...the COM itself will move by an amount that makes the true center of rotation in world space work out correctly. Sort of magical and elegant. The rotation point is just captured by the integration.

So, I hope that at least clarifies what to do. You should see this work out if you run some examples. The key is to get those constraint forces correct. In the case of bumping against a wall, then there is a contact constraint, e.g., go read Baraff again. In the case of turning a corner, there isn't really a constraint per say, just a friction force that you need to make sure you calculate correct. The magnitude is simple, just the rolling friction coefficient times the weight of the object. The direction is opposite the direction of the force applied by the bar that connects the car to the lorry. Get that all right before you do the integration, and you should see the COM shift/rotate about the wheel just automagically.

Graham Rhodes
Principal Scientist
Applied Research Associates, Inc.

[edited by - grhodes_at_work on April 22, 2004 1:47:48 PM]
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
i''m the same anon poster as above - SWEEEEEEEEEEEET. that''s exactly what i wanted to hear. i''ve honestly been worrying about it so much that i haven''t implemented a lot of stuff for fear that it wouldn''t work, due to what i mentioned.
wicked!
Glad to help!

Graham Rhodes
Principal Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net

This topic is closed to new replies.

Advertisement