MCPcopy Create free account
hub / github.com/axmolengine/axmol / removeJoint

Method removeJoint

core/physics/PhysicsWorld.cpp:679–715  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

677}
678
679void PhysicsWorld::removeJoint(PhysicsJoint* joint, bool destroy)
680{
681 if (joint)
682 {
683 if (joint->getWorld() != this && destroy)
684 {
685 AXLOGD(
686 "physics warning: the joint is not in this world, it won't be destroyed until the body it connects is "
687 "destroyed");
688 return;
689 }
690
691 joint->_destroyMark = destroy;
692
693 bool removedFromDelayAdd = false;
694 auto it = std::find(_delayAddJoints.begin(), _delayAddJoints.end(), joint);
695 if (it != _delayAddJoints.end())
696 {
697 _delayAddJoints.erase(it);
698 removedFromDelayAdd = true;
699 }
700
701 if (cpSpaceIsLocked(_cpSpace))
702 {
703 if (removedFromDelayAdd)
704 return;
705 if (std::find(_delayRemoveJoints.rbegin(), _delayRemoveJoints.rend(), joint) == _delayRemoveJoints.rend())
706 {
707 _delayRemoveJoints.emplace_back(joint);
708 }
709 }
710 else
711 {
712 doRemoveJoint(joint);
713 }
714 }
715}
716
717void PhysicsWorld::updateJoints()
718{

Callers 1

doRemoveJointMethod · 0.45

Calls 8

cpSpaceIsLockedFunction · 0.85
findFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45
rbeginMethod · 0.45
rendMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected