Tuning of Rotation-Translation Ratio?

eweitnauer
Posts: 7
Joined: Tue Jul 14, 2009 11:37 am

Tuning of Rotation-Translation Ratio?

Post by eweitnauer »

I am quite a beginner with bullet and I ran into the following problem:

I model one cylinder moving over a plane and pushing around an object lying on the plane. I also did the same thing in real world and compared the results. It turns out, that bullet translates the objects too much and rotates them too little. However, I didn't find the right parameters to tune that behavior.

Linear dumping and linear factor have no effect, unless I set them to 0 (then I get no translation at all). Angular factor and angular dumping have an effect for values < 0.25 but they only make the rotation even smaller instead of bigger of course. Changing the friction has some effect of course, but its no good to adjust that ratio.

So my question is:
How can I change the ratio between rotation and tranlation, when an object gets pushed?
User avatar
frca
Posts: 39
Joined: Sat May 02, 2009 9:38 am

Re: Tuning of Rotation-Translation Ratio?

Post by frca »

How much of a rotation acceleration body have, is driven among others by an inertia. But how to deal with it in bullet is a bit cryptic to me too.
eweitnauer
Posts: 7
Joined: Tue Jul 14, 2009 11:37 am

Re: Tuning of Rotation-Translation Ratio?

Post by eweitnauer »

I was digging a bit deeper into the sourcecode, but I couldn't figure out yet, why the linearFactor parameter is only having an effect when being close to zero (and in that case objects start to pass through each other).

I recorded some data with different values for linearFactor, angularFactor and inertiaScaling (I used shape->calculateLocalInertia(mass*inertia_scaling, inertia);) and plotted them as png-Images. You can find them attached to http://code.google.com/p/bullet/issues/detail?id=257.
eweitnauer
Posts: 7
Joined: Tue Jul 14, 2009 11:37 am

Re: Tuning of Rotation-Translation Ratio?

Post by eweitnauer »

Finally I have an explaination, why the translation/rotation ratio I got in bullet is so far from real experimental data. And I also found a way to improve the results! :D :D

But let's start with the explaination:
To keep things simple, lets assume the case of having a flat triangular-prism shaped object, lying on an even ground on one of its triangluar sides. Now some force is applied to the object and here is what happens:
When simulating the friction between object and ground and the momentum the object gains, bullet only uses the contact points it calculated before - which normally would be the corners of our prism. It then distributes the mass equally to these corners - which is fine for translation. But when it comes to rotation - if you only consider the corner points lying far from the center of gravity, friction and inertia will be estimated much higher than in the case of equal mass distribution over the whole base of the prism. This is why the bullet will let the object rotate too little.

After modifying all parameters of bullet that I could find - without success - I finally came up with a solution for the kind of simulation scenario I use bullet for:
I actually change the collision shape of my object by attaching a very flat layer right below its base. This layer has the same shape as the object (e.g. triangular for a trianglular-prism shape), but is scaled down. So now the object is actually resting on this smaller base area and so the contact points move further to the center.

For a triangle, when just considering the inertia, the correct scaling factor for the base layer is 0.5. So by adding a thin layer half the size of the actual shape to its bottom side, bullet will be tricked into using the correct inertia values and the results will become more realistic. In calculating the 0.5, I didnt take the effects of friction into account - so the optimal value could be a little different.

Cheers,
Erik.