Hey Norbo,
How do I make pair generation happen deterministically? I'm trying to make my simulation deterministic, but when I put a box shape with a NoSolver rule into the simulation, make a cylinder move through it, and log the pairs the narrow phase contains each frame, they end up being way off. Besides this scenario of using NoSolver entities as trigger areas, I've got the rest of my simulation running deterministically on the same machine, which mostly consists of cylinders and balls interacting with each other and static meshes. I have followed this problem back to the narrow phase pairs after seeing that contacts between the box and the cylinder were appearing at different frames (while looping through entity.CollisionInformation.Pairs to check if it should trigger).
I am running bepu with a single thread, my timestep is fixed, I'm setting the permutation index to the same number (1337) at the beginning of each simulation. I have made absolutely sure that physics objects are being added to the simulation at the same frame, and I'm not trying to rewind the simulation at all.
Deterministic Narrow Phase
Re: Deterministic Narrow Phase
Note that it's not quite sufficient to be added during the same frame. The order of all adds and removes matters, too.I have made absolutely sure that physics objects are being added to the simulation at the same frame
They are inserted into and removed from the broad phase incrementally, so any difference in order can change the topology of the broad phase tree, which changes the traversal order, which changes the order of the generated broad phase overlaps, which changes the order of generated pairs, which changes the order of solved constraints...
If you can't identify any ordering issues that might be at fault, I would recommend creating a simple reproduction case in the BEPUphysicsDemos or another even more minimalist example application. If you can get it to fail, I could take a look directly.
Re: Deterministic Narrow Phase
Wow, I am an absolute moron. I spent forever debugging this, dug super far into bepu, only to be led back out into my project... to find that there was a really obscure instance in which I was using an unseeded random number to set a physics object's orientation. I'm sorry I doubted you Norbo, lol
Re: Deterministic Narrow Phase
It happens to everyone ![Razz :P](./images/smilies/icon_razz.gif)
![Razz :P](./images/smilies/icon_razz.gif)