Description
Description
This isn't actually an issue, I'm just looking for guidance.
Suppose I have a rectangle (representing a brick) and a circle (representing a slow-ish bullet) and if the bullet hits the brick with enough speed I want to turn the brick from one object into two or three objects along fracture lines that seem intuitive.
Do you think it would work for me to modify the ContactManager.Collide()
method in such a way that it does two passes... The first pass could replace the bottom part of the function that looks like
// Here we destroy contacts that cease to overlap in the broad-phase.
if (overlap == false)
{
Contact cNuke = c;
c = cNuke.GetNext();
Destroy(cNuke);
continue;
}
// The contact persists.
c.Update(m_contactListener);
c = c.GetNext();
with something like
if (overlap == true)
{
...break brick into pieces if conditions are met...
}
and then the second pass would be exactly the code that's in the ContactManager.Collide()
method normally?
Or would this not work? Maybe I would need to rewind positions after the first pass? Possibly by capturing the world state at the beginning of the first pass and resetting it to that (except for the broken brick) before doing the second pass?