added substep allocation to physics simulation loop