本文整理汇总了C++中ogre::Entity::detachObjectFromBone方法的典型用法代码示例。如果您正苦于以下问题:C++ Entity::detachObjectFromBone方法的具体用法?C++ Entity::detachObjectFromBone怎么用?C++ Entity::detachObjectFromBone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Entity
的用法示例。
在下文中一共展示了Entity::detachObjectFromBone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _actionChangeWeapon
//newWep should be either 'Rifle','Pistol' or 'None'
void EnemyCharacter::_actionChangeWeapon(const std::string& newWep)
{
if(_currentWeapon.node != nullptr)
{
if(_currentWeapon.node->getAttachedObject(0) == nullptr)
{
//re-add the gun entity back to the original node.
Ogre::Entity* characterEntity = static_cast<Ogre::Entity*>(_movableObject);
Ogre::MovableObject* attachedWeap = characterEntity->detachObjectFromBone(_currentWeapon.weapon->_getGunNameString());
_currentWeapon.node->attachObject(attachedWeap);
}
}
//switch the _currentWeapon
if(newWep == "Rifle"){ _currentWeapon = _weaponRifle; }
if(newWep == "Pistol") { _currentWeapon = _weaponPistol; }
if(newWep == "None") { _currentWeapon.node = nullptr; _currentWeapon.weapon = nullptr; }
if(_currentWeapon.node != nullptr)
{
Ogre::MovableObject* unattachedWeap = _currentWeapon.node->detachObject(static_cast<unsigned short>(0));
static_cast<Ogre::Entity*>(_movableObject)->attachObjectToBone("FIRESPOT",unattachedWeap);
}
}
示例2: DetachMeshFromBone
void EC_Mesh::DetachMeshFromBone()
{
if ((!entity_) || (!attached_to_bone_) || (!bone_parent_mesh_))
return;
Ogre::Entity* targetEntity = bone_parent_mesh_->GetEntity();
if (targetEntity)
targetEntity->detachObjectFromBone(entity_);
else
return;
bone_parent_mesh_->bone_attached_mesh_ = 0;
bone_parent_mesh_ = 0;
attached_to_bone_ = false;
bone_tagpoint_ = 0;
// Reattach entity to normal placeable
AttachEntity();
}