Avoid penetration's severe reaction

Post Reply
jcrada
Posts: 11
Joined: Thu Oct 09, 2008 10:59 pm

Avoid penetration's severe reaction

Post by jcrada »

Hi, I am creating a ragdoll following the RagdollDemo but I am encountering some difficulties related to penetration reaction. For example, I am using a btGeneric6DofJoint for the shoulder joint with angular limits that make the upperarm penetrate the spine when these values are very low or very high. The problem I am having is that when the upperarm collides with the spine it has a reaction bouncing in the opposite direction (as expected) but it has such a force that it makes the whole body fall to the ground and start trembling.
Is there a way to avoid this reaction or make it more subtle? I really need it not to bounce but to stick to the spine when the lower or higher angles are reached. I used for all bodies setRestitution(0.0) but it does not appear to help.
What else can I do to avoid such a strong reaction?

The dimensions for the spine and upperarms are:

Code: Select all

       SIZE_SCALE = 1.0;
       _limb_size[SPINE][X] = 0.305 * SIZE_SCALE;
       _limb_size[SPINE][Y] = (0.590 + 0.239) * SIZE_SCALE;
       _limb_size[SPINE][Z] = 0.225 * SIZE_SCALE;
       _limb_size[SPINE][R] = ((0.305 + 0.225) / 2.0) * SIZE_SCALE;
       _limb_size[LUPPERARM][X] = _limb_size[RUPPERARM][X] = 0.311 * SIZE_SCALE;
       _limb_size[LUPPERARM][Y] = _limb_size[RUPPERARM][Y] = 0.090 * SIZE_SCALE;
       _limb_size[LUPPERARM][Z] = _limb_size[RUPPERARM][Z] = 0.090 * SIZE_SCALE;
       _limb_size[LUPPERARM][R] = _limb_size[RUPPERARM][R] = 0.045 * SIZE_SCALE;
And the code for the shoulder joint is as follows:

Code: Select all

       localA.setIdentity();
       localB.setIdentity();
       localA.setOrigin(btVector3((-getSize(SPINE, X) / 2.0) , getSize(SPINE, Y) / 2.0, 0.0));
       localB.setOrigin(btVector3((getSize(LUPPERARM, X) / 2.0) + getSize(LUPPERARM,R),    getSize(LUPPERARM, Y) / 2.0, 0.0));

       g6dof = new btGeneric6DofConstraint(*getRigidBody(SPINE),*getRigidBody(LUPPERARM), localA, localB, use_linear_reference_frame_a);
       g6dof->setLinearLowerLimit(btVector3(0, 0, 0));
       g6dof->setLinearUpperLimit(btVector3(0, 0, 0));
       g6dof->setAngularLowerLimit(btVector3(0, -M_PI_2, 0));
       g6dof->setAngularUpperLimit(btVector3(0, M_PI_2, 0));
I know it lacks another degree of freedom, but I want to fix rotation around Y before adding the other.
And one last question, what does the param use_linear_reference_frame_a? I have tried using it as true and false, but have not found any difference.
Thanks in advance.

PS: Attached is a picture of the ragdoll showing the limb (in black) that is causing the reaction when the Y axis is rotated PI/2 or -PI/2.
Attachments
The limb in black is the one that shows the problem I am having.
The limb in black is the one that shows the problem I am having.
Simulador de Criaturas.png (26.69 KiB) Viewed 3412 times
jcrada
Posts: 11
Joined: Thu Oct 09, 2008 10:59 pm

Re: Avoid penetration's severe reaction

Post by jcrada »

Hi. After many experiments I have reach the conclusion that the problem is the angular limits in axis Y. Using the following code makes the simulation run smooth for me. I found no problem having [-M_PI_2, M_PI_2] as angular limits in axis X and Z.

Code: Select all

       g6dof->setAngularLowerLimit(btVector3(0, (2.0 / 3.0) -M_PI_2, 0));
       g6dof->setAngularUpperLimit(btVector3(0, (2.0 / 3.0) M_PI_2, 0));
Is there anyone having the same issue? Or am I doing something wrong?
Post Reply