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


C++ Entity::detachObjectFromBone方法代码示例

本文整理汇总了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);
	}
	
}
开发者ID:Dar13,项目名称:WastelandArchive,代码行数:26,代码来源:enemy_character.cpp

示例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();
}
开发者ID:A-K,项目名称:naali,代码行数:19,代码来源:EC_Mesh.cpp


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