Ejemplo n.º 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);
}
Ejemplo n.º 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;
    }
}
Ejemplo n.º 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);
    }
}