mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-27 15:25:54 -04:00
physics: Don't assert destructing
This could have been produced with make_copy(), which can create a situation where the Physical objects don't have the same node associated -- see b6a118448dce974d25c1d5ae4043baa6dfe12db0
This commit is contained in:
parent
b6a118448d
commit
74910ff310
@ -43,13 +43,12 @@ PhysicalNode(const PhysicalNode ©) :
|
||||
*/
|
||||
PhysicalNode::
|
||||
~PhysicalNode() {
|
||||
PhysicalsVector::iterator it;
|
||||
for (it = _physicals.begin(); it != _physicals.end(); ++it) {
|
||||
Physical *physical = *it;
|
||||
nassertd(physical->_physical_node == this) continue;
|
||||
physical->_physical_node = nullptr;
|
||||
if (physical->_physics_manager != nullptr) {
|
||||
physical->_physics_manager->remove_physical(physical);
|
||||
for (Physical *physical : _physicals) {
|
||||
if (physical->_physical_node == this) {
|
||||
physical->_physical_node = nullptr;
|
||||
if (physical->_physics_manager != nullptr) {
|
||||
physical->_physics_manager->remove_physical(physical);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user