Lack of determinism?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Lack of determinism?

Postby Julio Jerez » Sat Aug 01, 2009 7:30 pm

Agi Mark is right, something is very wrong somewhere.
I probably adde some variable to a joint or to a body that is not clean up properly by Invalidate Cache.
I am debugging int now.
I missed Marc test before.

Any way even if whe Agi say works, Invalidate cache is the proper way to do it.
Marc is using it the way is supposed to be used afet he change data on abody or joint, or after he add or remove bodies or joints.
Code: Select all
   
   for (i=0;i<n;i++)
   {
      if (i == 3)
         NewtonBodySetForceAndTorqueCallback (body[i], PhysicsApplyForceAndTorque0);
      else
         NewtonBodySetForceAndTorqueCallback (body[i], PhysicsApplyForceAndTorque1);


      NewtonBodySetAutoSleep(body[i],0);
      NewtonBodySetFreezeState(body[i],0);   // NewtonWorldUnfreezeBody(nWorld,body[i]);
      NewtonBodySetMatrix(body[i],pos);
      NewtonBodySetVelocity(body[i],vel);
      NewtonBodySetOmega(body[i],omega);
      //NewtonBodySetUserData(body[i], (void *)i);
   }

   NewtonInvalidateCache(nWorld);
   for (i = 0; i < loops; ++i)
   {
      NewtonUpdate(nWorld,0.016f);
   }


You can look at invalidate cache as check points for synchronization,
for example you can get the that is velocity and position of all bodies in the scene and call Invalidate cache,
Then after few updates, you can restore the position and velocities and call invalidate cache an run the scene again.
It is suppose to generate the same sequence, but it is no now.
I need to find out why but Marc is doing it right.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 34 guests