| 863 | } |
| 864 | |
| 865 | void RenderManager::rrCreateWeapon(Creature* curCreature, const Weapon* curWeapon, const std::string& hand) |
| 866 | { |
| 867 | Ogre::Entity* ent = mSceneManager->getEntity(curCreature->getOgreNamePrefix() + curCreature->getName()); |
| 868 | std::string weaponName = curWeapon->getOgreNamePrefix() + hand; |
| 869 | if(!ent->getSkeleton()->hasBone(weaponName)) |
| 870 | { |
| 871 | OD_LOG_WRN("Tried to add weapons to entity \"" + ent->getName() + " \" using model \"" + |
| 872 | ent->getMesh()->getName() + "\" that is missing the required bone \"" + |
| 873 | curWeapon->getOgreNamePrefix() + hand + "\""); |
| 874 | return; |
| 875 | } |
| 876 | Ogre::Bone* weaponBone = ent->getSkeleton()->getBone( |
| 877 | curWeapon->getOgreNamePrefix() + hand); |
| 878 | Ogre::Entity* weaponEntity = mSceneManager->createEntity(curWeapon->getOgreNamePrefix() |
| 879 | + hand + "_" + curCreature->getName(), |
| 880 | curWeapon->getMeshName()); |
| 881 | |
| 882 | // Rotate by -90 degrees around the x-axis from the bone's rotation. |
| 883 | Ogre::Quaternion rotationQuaternion; |
| 884 | rotationQuaternion.FromAngleAxis(Ogre::Degree(-90.0), Ogre::Vector3(1.0, |
| 885 | 0.0, 0.0)); |
| 886 | |
| 887 | ent->attachObjectToBone(weaponBone->getName(), weaponEntity, |
| 888 | rotationQuaternion); |
| 889 | } |
| 890 | |
| 891 | void RenderManager::rrDestroyWeapon(Creature* curCreature, const Weapon* curWeapon, const std::string& hand) |
| 892 | { |
no test coverage detected