Question about NarrowPhase.RemoveStaleOverlaps()
Posted: Fri Mar 09, 2012 11:53 pm
Hi,
I was trying to figure out a reference leak of NarrowPhasePairs related to entities (a standard compound body) that have been removed from the Space, and it turns out that since both the entity being removed is inactive and the custom Collidable object's IsActive property always return false was causing the NarrowPhase.RemoveStaleOverlaps() to never remove the NarrowPhasePair that had been created between the entity and my custom Collidable. Changing my Collidable's IsActive to always return true corrected this and allowed the NarrowPhasePair to be removed as expected, but I am now wondering if there is something else I need to know about the situation. Namely, why is it that RemoveStaleOverlaps shouldn't remove pairs unless at least one item is active? Perhaps I am hitting an unexpected edge case related to the fact I am removing objects from the world? Perhaps there is some meaning to BroadPhaseEntry.IsActive other than what I expect which is that it is true if the object is moving. Should I expect a penalty for leaving the BroadPhaseEntry.IsActive true on an otherwise stationary/static object?
To put it in context a bit, these are rigid bodies that are related to NPC corpses that are stationary on the ground and need to be removed from the world. The custom Collider is my terrain.
Thanks for any feedback or suggestions,
I was trying to figure out a reference leak of NarrowPhasePairs related to entities (a standard compound body) that have been removed from the Space, and it turns out that since both the entity being removed is inactive and the custom Collidable object's IsActive property always return false was causing the NarrowPhase.RemoveStaleOverlaps() to never remove the NarrowPhasePair that had been created between the entity and my custom Collidable. Changing my Collidable's IsActive to always return true corrected this and allowed the NarrowPhasePair to be removed as expected, but I am now wondering if there is something else I need to know about the situation. Namely, why is it that RemoveStaleOverlaps shouldn't remove pairs unless at least one item is active? Perhaps I am hitting an unexpected edge case related to the fact I am removing objects from the world? Perhaps there is some meaning to BroadPhaseEntry.IsActive other than what I expect which is that it is true if the object is moving. Should I expect a penalty for leaving the BroadPhaseEntry.IsActive true on an otherwise stationary/static object?
To put it in context a bit, these are rigid bodies that are related to NPC corpses that are stationary on the ground and need to be removed from the world. The custom Collider is my terrain.
Thanks for any feedback or suggestions,