void NewtonBodyApplyImpulsePair with a zero impulse one every object every frame.
- > newton_d.dll!dgBody::ApplyImpulsePair(const dgVector & linearImpulseIn, const dgVector & angularImpulseIn, float timestep) Line 698 C++
newton_d.dll!NewtonBodyApplyImpulsePair(const NewtonBody * const bodyPtr, float * const linearImpulse, float * const angularImpulse, float timestep) Line 6244 C++
MyGame.debug.exe!00c19fd1() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for MyGame.debug.exe]
that function wakes up a body, but because it does not apply any state change so what happens is the the body is send to the solver and the solver apply a contact force that set the velocity to 0.0001 m/s
and integrate the body for one frame. The velocity change is below the sleep threshold so the body goes to sleep again, but is wakes up by the call to NewtonBodyApplyImpulsePair with zero impulse.
Basically you are using NewtonBodyApplyImpulsePair to manipulate the body.
In general NewtonBodyApplyImpulsePair is used to apply some non zero impulse, calling it to do something else, I do not know what the result is.
what is it that you are trying to do by calling Set Matrix or apply impulse?
anyway I added a check that if the impulse is zero, not to wake up the body, and that fix the problem. I could not test the first demo since the later overrode the first.
Sync and try again. see if that fixes the bug.