this is very strange, the behavior you are describing is what will happen when I add the deferred add body, joints, and models.
by I have not done that yet.
bodies are added immediate, what there are added form outside an update.
I modify the sandBox so that is play the rigid bod demo, it only add one capsule.
the I set a break point on these lines:
bool ndScene::AddBody(ndBodyKinematic* const body)
void ndDemoEntityNotify::OnApplyExternalForce(ndInt32, ndFloat32)
void ndBodyKinematic::IntegrateExternalForce(ndFloat32 timestep)
and I do get the call one after the other in that order when creation just that one capsule.
let us this:
first let us rule out async update so that it is easier to debug. in cmake set define
NEWTON_BUILD_SINGLE_THREADED
true and build the engine.
this will let you run the engine in the same thread that create it.
fir see if the bug goes away.
if not Sync to github, I set that test for one body and I do not see that problem, see if you can see it.
if you do not, then you are doing something that is causing it maybe you can, make a test that recrate the behavior using the Test build.
in cmake select NEWTON_BUILD_TEST and make the engine, this create the simpler demo IO can this
- Code: Select all
int main (int, const char*)
{
ndWorld world;
world.SetSubSteps(2);
ndVector size(0.5f, 0.25f, 0.8f, 0.0f);
ndVector origin(0.0f, 0.0f, 0.0f, 0.0f);
BuildFloorBox(world);
BuildSphere(world, 1.0f, origin + ndVector(3.0f, 0.0f, 0.0f, 0.0f), 1.0f, 1, 1.0f);
ndFloat32 totalTime = 0;
for (ndInt32 i = 0; i < 10000; i ++)
{
world.Update(1.0f / 60.0f);
totalTime += world.GetUpdateTime();
newton.Sync();
}
return 0;
}
off, make you can recreate teh bug there