jitter and the well tuned rigid body...

chutoi
Posts: 16
Joined: Fri Aug 10, 2012 4:21 pm

jitter and the well tuned rigid body...

Post by chutoi »

Good afternoon,

I'm implementing a character avatar. I had little luck with the character controller object so I'm doing in manually.
I'll probably learn a lot ;)

I'm trying to achieve an avatar that can fall, be affected by objects hitting it, and jump appropriately.

I created a rigid body with a capsule that encompasses the avatar. A motion state tied to it provides motion information from the body to to the rendered mesh. He falls correctly and lands on the landscape properly but then if he landed on a slope the avatar would fall over. Drunken avatars falling over are only funny for a little while...

I changed to a AABB rigid body for the avatar. Now he falls correctly and lands on the landscape properly.
It stays upright, bounces realistically, but jitters a bit on landing. If you move the avatar then it falls over again.

I added a custom constraint to keep the avatar upright but the jitter is very bad after he moves onto a slope.

I thought if I made him 'heavier' then the jitter would dampen faster.
I changed the mass from 1.0f to 85.0f (I assume the default calculations are in kilograms?).
Now it jitters worse and doesn't want to dampen out.

Any suggestions on direction?

I could create a more accurate version of the biped's body with separate feet and hinge constraints on the leg joints. I'm not sure if that would slide on terrain as well though. This sounds awfully slow to evaluate though.

I'm not sure why movement would cause jitter. I thought I was clearing all the forces on the object after each movement:

Code: Select all

   void Avatar::setPosition( float x, float y, float z )
   {
      btTransform transform = Body->getCenterOfMassTransform();
      transform.setOrigin( btVector3( x, y, z ) );
      Body->setCenterOfMassTransform( transform );

      // reset interpolation between frames
      Body->setInterpolationWorldTransform( Body->getWorldTransform() );
      Body->setInterpolationLinearVelocity( btVector3( 0, 0, 0 ) );
      Body->setInterpolationAngularVelocity( btVector3( 0, 0, 0 ) );
   }
Any ideas would be a great help
Shogo
Posts: 6
Joined: Tue Aug 07, 2012 3:27 am

Re: jitter and the well tuned rigid body...

Post by Shogo »

Hello. To keep your capsule from falling over you can do:

Code: Select all

yourCapsule->setAngularFactor(0.0);