When I divide the mass of the rootbody by 10 (the one which is clamped) the equilibrium position changes (the limb body being unchanged) :
- Code: Select all
static void AttachLimbBody(DemoEntityManager* const scene, const dVector& dir, NewtonBody* const parent, float masse)
{
NewtonWorld* const world = scene->GetNewton();
dVector size(0.4f, 0.25f, 1.5f, 0.0f);
NewtonCollision* const collision = CreateConvexCollision(world, dGetIdentityMatrix(), size, _BOX_PRIMITIVE, 0);
DemoMesh* const geometry = new DemoMesh("box", scene->GetShaderCache(), collision, "smilli.tga", "logo_php.tga", "frowny.tga");
dMatrix location;
NewtonBodyGetMatrix(parent, &location[0][0]);
location.m_posit += dir.Scale(0.5f * size.m_z);
location.m_posit.m_y -= 0.5f;
NewtonBody* const rootBody = CreateSimpleSolid(scene, geometry, masse, location, collision, 0);
location.m_posit -= dir.Scale(0.5f * size.m_z);
dMatrix Ankle_LPinMatrix(dGetIdentityMatrix()); //flexion twist
Ankle_LPinMatrix = Ankle_LPinMatrix * dRollMatrix(90.0f * dDegreeToRad);//torsion twist
Ankle_LPinMatrix.m_posit += dir.Scale(0.5f * size.m_z);
Ankle_LPinMatrix.m_posit.m_y -= 0.5f;
Ankle_LPinMatrix.m_posit -= dir.Scale(0.5f * size.m_z);
dCustomSlider* const hinge = new dCustomSlider(Ankle_LPinMatrix, rootBody, parent);
hinge->SetAsSpringDamper(true,1.0f, 2000.f , 50.f );
geometry->Release();
NewtonDestroyCollision(collision);
}
static void AddRagdollBodies(DemoEntityManager* const scene, NewtonBody* const floor)
{
NewtonWorld* const world = scene->GetNewton();
dVector size(0.2f, 1.0f, 0.2f, 0.0f);
dMatrix location(dGetIdentityMatrix());
location.m_posit.m_y = 4.0f;
NewtonCollision* const collision = CreateConvexCollision(world, dGetIdentityMatrix(), size, _BOX_PRIMITIVE, 0);
DemoMesh* const geometry = new DemoMesh("box", scene->GetShaderCache(), collision, "smilli.tga", "logo_php.tga", "frowny.tga");
location.m_posit.m_z = 5.0f;
float rootmass = 1.f;
for (int i = 0; i < 1; i++) {
NewtonBody* const rootBody = CreateSimpleSolid(scene, geometry, rootmass, location, collision, 0);
new dCustomSixdof (location, rootBody, NULL);
dMatrix matrix;
NewtonBodyGetMatrix(rootBody, &matrix[0][0]);
AttachLimbBody(scene, matrix.m_right.Scale(-1.0f), rootBody, 1.f * (i+1) );
location.m_posit.m_z += 2.5f;
}
changed rootmass from 10.f :
to 1.f :
used newton-dynamics-3c49b796a38213cb1d5370cf0a3722b075f93a77