void PhysicsWorld::updateJoints() { if (_info->isLocked()) { return; } for (auto joint : _delayAddJoints) { doAddJoint(joint); } for (auto joint : _delayRemoveJoints) { doRemoveJoint(joint); if (joint->_destoryMark) { delete joint; } } _delayAddJoints.clear(); _delayRemoveJoints.clear(); }
void PhysicsWorld::updateJoints() { if (m_pInfo->getSpace()->locked) { return; } for (auto joint : m_aDelayAddJoints) { doAddJoint(joint); } for (auto joint : m_aDelayRemoveJoints) { doRemoveJoint(joint); if (joint->m_bDestoryMark) { delete joint; } } m_aDelayAddJoints.clear(); m_aDelayRemoveJoints.clear(); }
void PhysicsWorld::updateJoints() { if (_info->isLocked()) { return; } auto addCopy = _delayAddJoints; _delayAddJoints.clear(); for (auto joint : addCopy) { doAddJoint(joint); } auto removeCopy = _delayRemoveJoints; _delayRemoveJoints.clear(); for (auto joint : removeCopy) { doRemoveJoint(joint); if (joint->_destoryMark) { delete joint; } } }
void PhysicsWorld::addJointOrDelay(PhysicsJoint* joint) { auto it = std::find(_delayRemoveJoints.begin(), _delayRemoveJoints.end(), joint); if (it != _delayRemoveJoints.end()) { _delayRemoveJoints.erase(it); return; } if (_info->isLocked()) { if (std::find(_delayAddJoints.begin(), _delayAddJoints.end(), joint) == _delayAddJoints.end()) { _delayAddJoints.push_back(joint); _delayDirty = true; } }else { doAddJoint(joint); } }
void PhysicsWorld::addJointOrDelay(PhysicsJoint* joint) { auto it = std::find(m_aDelayRemoveJoints.begin(), m_aDelayRemoveJoints.end(), joint); if (it != m_aDelayRemoveJoints.end()) { m_aDelayRemoveJoints.erase(it); return; } if (m_pInfo->getSpace()->locked) { if (std::find(m_aDelayAddJoints.begin(), m_aDelayAddJoints.end(), joint) == m_aDelayAddJoints.end()) { m_aDelayAddJoints.push_back(joint); m_bDelayDirty = true; } }else { doAddJoint(joint); } }