예제 #1
0
PhysicsBody::~PhysicsBody()
{
    for (auto it = _joints.begin(); it != _joints.end(); ++it)
    {
        PhysicsJoint* joint = *it;
        
        PhysicsBody* other = joint->getBodyA() == this ? joint->getBodyB() : joint->getBodyA();
        other->removeJoint(joint);
        delete joint;
    }
    
    CC_SAFE_DELETE(_info);
}
예제 #2
0
PhysicsBody::~PhysicsBody()
{
    CC_SAFE_DELETE(_info);
    
    removeAllShapes();
    
    for (auto it = _joints.begin(); it != _joints.end(); ++it)
    {
        PhysicsJoint* joint = *it;
        PhysicsBody* other = joint->getBodyA() == this ? joint->getBodyA() : joint->getBodyB();
        
        other->_joints.erase(std::find(other->_joints.begin(), other->_joints.end(), joint));
        delete joint;
    }
}
예제 #3
0
PhysicsBody::~PhysicsBody()
{
    for (auto it = _joints.begin(); it != _joints.end(); ++it)
    {
        PhysicsJoint* joint = *it;

        PhysicsBody* other = joint->getBodyA() == this ? joint->getBodyB() : joint->getBodyA();
        other->removeJoint(joint);
        delete joint;
    }

    if (_cpBody)
    {
        cpBodyFree(_cpBody);
    }
}