I've been having lots of issues with positions heading to NaN when I spawn bodies using code similar to this:
for (int i = 0; i < NumberOfChildren; ++i)
var newChild = (Enemy)AssetManager.GetNewEnemyInstance(ChildType);
newChild.Position = this.Position;
I've tried various things such as shifting the starting position toward edge of the parent enemy and giving the children starting velocities outward from the parent's center, but given 4-5 of these parents spawning 3-8 children a piece in the same frame, the
game will seize while the TOI code runs through it's many iterations to eventually give NaN positions.
These freezes are even easier to reproduce when using bombs, which cause the parents to run the above code in one frame and children to be disposed in the next.
Is there anything I can do about this?