当前位置: 首页>>代码示例>>C++>>正文


C++ PhysicsBody::removeJoint方法代码示例

本文整理汇总了C++中PhysicsBody::removeJoint方法的典型用法代码示例。如果您正苦于以下问题:C++ PhysicsBody::removeJoint方法的具体用法?C++ PhysicsBody::removeJoint怎么用?C++ PhysicsBody::removeJoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhysicsBody的用法示例。


在下文中一共展示了PhysicsBody::removeJoint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: removeBody

void PhysicsWorld::removeBody(PhysicsBody* body)
{
    
    if (body->getWorld() != this)
    {
        CCLOG("Physics Warnning: this body doesn't belong to this world");
        return;
    }
    
    // destory the body's joints
    for (auto joint : body->_joints)
    {
        // set destroy param to false to keep the iterator available
        removeJoint(joint, false);
        
        PhysicsBody* other = (joint->getBodyA() == body ? joint->getBodyB() : body);
        other->removeJoint(joint);
        
        // test the distraction is delaied or not
        if (_delayRemoveJoints.size() > 0 && _delayRemoveJoints.back() == joint)
        {
            joint->_destoryMark = true;
        }
        else
        {
            delete joint;
        }
    }
    
    body->_joints.clear();
    
    removeBodyOrDelay(body);
    _bodies.eraseObject(body);
    body->_world = nullptr;
}
开发者ID:6520874,项目名称:pipiGame,代码行数:35,代码来源:CCPhysicsWorld.cpp

示例2:

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);
}
开发者ID:highjin,项目名称:ProjectArthas,代码行数:13,代码来源:CCPhysicsBody.cpp

示例3: cpBodyFree

PhysicsBody::~PhysicsBody()
{
    for (auto& joint : _joints)
    {
        PhysicsBody* other = joint->getBodyA() == this ? joint->getBodyB() : joint->getBodyA();
        other->removeJoint(joint);
        delete joint;
    }
    
    if (_cpBody)
    {
        cpBodyFree(_cpBody);
    }
}
开发者ID:bonlai,项目名称:3kaigame,代码行数:14,代码来源:CCPhysicsBody.cpp

示例4: cpBodyFree

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);
    }
}
开发者ID:Realtrick-Games,项目名称:DeadForest,代码行数:16,代码来源:CCPhysicsBody.cpp


注:本文中的PhysicsBody::removeJoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。