I do not know why will this be different with or with out calling the scale, the scale is simple 1, it should no make any difference.
they only thong I can try is try to recreate what you are doing in the sandbox demo.
The sandbox has a ragdoll demo, I can probably past the same code you are using to do the scaling and see if I can reproduce the bug.
specially since I am still no sure how I will detect the bug when if it happens.
try doing this, in this function
- Code: Select all
void NewtonBodySetCollisionScale (const NewtonBody* const bodyPtr, dFloat scaleX, dFloat scaleY, dFloat scaleZ)
{
TRACE_FUNCTION(__FUNCTION__);
dgBody* const body = (dgBody *)bodyPtr;
dgWorld* const world = body->GetWorld();
NewtonCollision* const collision = NewtonBodyGetCollision(bodyPtr);
world->Sync ();
dgFloat32 mass = body->GetInvMass().m_w > dgFloat32 (0.0f) ? body->GetMass().m_w : dgFloat32 (0.0f);
NewtonCollisionSetScale (collision, scaleX, scaleY, scaleZ);
NewtonJoint* nextJoint;
for (NewtonJoint* contactJoint = NewtonBodyGetFirstContactJoint(bodyPtr); contactJoint; contactJoint = nextJoint) {
nextJoint = NewtonBodyGetNextContactJoint(bodyPtr, contactJoint);
world->DestroyConstraint ((dgConstraint*)contactJoint);
}
NewtonBodySetMassProperties (bodyPtr, mass, collision);
world->GetBroadPhase()->ResetEntropy ();
}
comment out these lines
NewtonBodySetMassProperties (bodyPtr, mass, collision);
world->GetBroadPhase()->ResetEntropy ();
and see If the Bug goes away., then try commenting only the last line and so on maybe we can see whis of those function introduce the malfunction.