In b2World -> Step move this call:
To here (after Solve & SolveTOI calls):
Now the contact listener will report contacts in sync with the position of your bodies.
I looked back at Erin's comments when I first brought this up:
So, if you add a new body/shape, this is what's going to happen (with this change implemented):
1. Your body/shape wont be moved by the contact solver until the next timestep.
2. You'll still get contact events for the new body/shape (I'm pretty sure of this, anyway).
The more I think about this the more I'm fine with it... If I add a body right on top of another body, it will stay there for one time step, and then pushed outwards the next. Lets say I click to add a body... I'd expect to see that body under my cursor for at least a brief moment.
This also makes the calls to Solve and SolveTOI in the first timestep essentially useless.
EDIT: Result events are still delayed.
Code: Select all
m_contactManager.Collide();
To here (after Solve & SolveTOI calls):
Code: Select all
m_contactManager.Collide();
DrawDebugData();
Now the contact listener will report contacts in sync with the position of your bodies.
I looked back at Erin's comments when I first brought this up:
I have to evaluate contact points at the beginning of the time step so that newly added bodies generate contact points in the first time step.
So, if you add a new body/shape, this is what's going to happen (with this change implemented):
1. Your body/shape wont be moved by the contact solver until the next timestep.
2. You'll still get contact events for the new body/shape (I'm pretty sure of this, anyway).
The more I think about this the more I'm fine with it... If I add a body right on top of another body, it will stay there for one time step, and then pushed outwards the next. Lets say I click to add a body... I'd expect to see that body under my cursor for at least a brief moment.
This also makes the calls to Solve and SolveTOI in the first timestep essentially useless.
EDIT: Result events are still delayed.