Hi,
tl;dr: which file/function should I start with, if I wanted to find out where the body
transform (or velocity) gets corrupted?
I have an obscure bug where the collision between a kinematic and dynamic body
results in random states for both bodies, ie their transforms, linear/angular
velocities contain what seems to be random numbers.
So far I have been unable to reproduce this problem in a standalone program,
but I can often trigger it as part of a bigger application. My question to the list:
which Newton methods would make for a good starting point to populate with
debug assert on eg the velocity (I know it must be small, no matter what)?
Some background on the setup: the collision shapes are compounds, even though
they contain only one shape at the moment (a sphere and box, respectively). The
dynamic body is initially at rest. Neither body has an angular velocity, and
both have unit mass and inertia. The simulation (slowly) moves the kinematic
sphere towards the dynamic box. Everything is fine until they touch. Once they
do, the state (ie transform, linear/angular velocity) of _both_ bodies is
corrupt.
This does not always happen on the first collision, but it rarely survives 3
collisions. In rare cases, the bug does not trigger at all, but the kinematic
body pushes the dynamic one, as intended.
I have also tried to rewind the simulation, ie. store the transforms and
velocities at each step, and reload it when the error occurs (with- and
without invalidating the cache). It always triggers again. However, when
I load those values at the start of the program, the bug does not trigger.
The bug has never triggered when both bodies are dynamic.
I am a bit at a loss with this. The corrupt state is the only lead I have
so far, hence my question as to where I should start placing asserts. Any
suggestions would be greatly appreciated.
Btw, I use a debug build with threads disabled. I am on Ubuntu 16.04, my
Newton version is ~2 weeks old.