mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 23:53:56 +00:00
Merge pull request #3004 from akortunov/arrow_attach
Attach arrows to actor's hands
This commit is contained in:
commit
e65fad2070
5 changed files with 53 additions and 37 deletions
|
@ -69,6 +69,7 @@
|
||||||
Feature #5545: Option to allow stealing from an unconscious NPC during combat
|
Feature #5545: Option to allow stealing from an unconscious NPC during combat
|
||||||
Feature #5579: MCP SetAngle enhancement
|
Feature #5579: MCP SetAngle enhancement
|
||||||
Feature #5610: Actors movement should be smoother
|
Feature #5610: Actors movement should be smoother
|
||||||
|
Feature #5642: Ability to attach arrows to actor skeleton instead of bow mesh
|
||||||
Task #5480: Drop Qt4 support
|
Task #5480: Drop Qt4 support
|
||||||
Task #5520: Improve cell name autocompleter implementation
|
Task #5520: Improve cell name autocompleter implementation
|
||||||
|
|
||||||
|
|
|
@ -239,7 +239,7 @@ namespace MWMechanics
|
||||||
/* short group */ "",
|
/* short group */ "",
|
||||||
/* long group */ "",
|
/* long group */ "",
|
||||||
/* sound ID */ "Item Ammo",
|
/* sound ID */ "Item Ammo",
|
||||||
/* attach bone */ "ArrowBone",
|
/* attach bone */ "Bip01 Arrow",
|
||||||
/* sheath bone */ "",
|
/* sheath bone */ "",
|
||||||
/* usage skill */ ESM::Skill::Marksman,
|
/* usage skill */ ESM::Skill::Marksman,
|
||||||
/* weapon class*/ ESM::WeaponType::Ammo,
|
/* weapon class*/ ESM::WeaponType::Ammo,
|
||||||
|
|
|
@ -252,11 +252,15 @@ osg::Group *CreatureWeaponAnimation::getArrowBone()
|
||||||
int type = weapon->get<ESM::Weapon>()->mBase->mData.mType;
|
int type = weapon->get<ESM::Weapon>()->mBase->mData.mType;
|
||||||
int ammoType = MWMechanics::getWeaponType(type)->mAmmoType;
|
int ammoType = MWMechanics::getWeaponType(type)->mAmmoType;
|
||||||
|
|
||||||
SceneUtil::FindByNameVisitor findVisitor (MWMechanics::getWeaponType(ammoType)->mAttachBone);
|
// Try to find and attachment bone in actor's skeleton, otherwise fall back to the ArrowBone in weapon's mesh
|
||||||
|
osg::Group* bone = getBoneByName(MWMechanics::getWeaponType(ammoType)->mAttachBone);
|
||||||
|
if (bone == nullptr)
|
||||||
|
{
|
||||||
|
SceneUtil::FindByNameVisitor findVisitor ("ArrowBone");
|
||||||
mWeapon->getNode()->accept(findVisitor);
|
mWeapon->getNode()->accept(findVisitor);
|
||||||
|
bone = findVisitor.mFoundNode;
|
||||||
return findVisitor.mFoundNode;
|
}
|
||||||
|
return bone;
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Node *CreatureWeaponAnimation::getWeaponNode()
|
osg::Node *CreatureWeaponAnimation::getWeaponNode()
|
||||||
|
|
|
@ -1078,10 +1078,15 @@ osg::Group* NpcAnimation::getArrowBone()
|
||||||
int type = weapon->get<ESM::Weapon>()->mBase->mData.mType;
|
int type = weapon->get<ESM::Weapon>()->mBase->mData.mType;
|
||||||
int ammoType = MWMechanics::getWeaponType(type)->mAmmoType;
|
int ammoType = MWMechanics::getWeaponType(type)->mAmmoType;
|
||||||
|
|
||||||
SceneUtil::FindByNameVisitor findVisitor (MWMechanics::getWeaponType(ammoType)->mAttachBone);
|
// Try to find and attachment bone in actor's skeleton, otherwise fall back to the ArrowBone in weapon's mesh
|
||||||
|
osg::Group* bone = getBoneByName(MWMechanics::getWeaponType(ammoType)->mAttachBone);
|
||||||
|
if (bone == nullptr)
|
||||||
|
{
|
||||||
|
SceneUtil::FindByNameVisitor findVisitor ("ArrowBone");
|
||||||
part->getNode()->accept(findVisitor);
|
part->getNode()->accept(findVisitor);
|
||||||
|
bone = findVisitor.mFoundNode;
|
||||||
return findVisitor.mFoundNode;
|
}
|
||||||
|
return bone;
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Node* NpcAnimation::getWeaponNode()
|
osg::Node* NpcAnimation::getWeaponNode()
|
||||||
|
|
|
@ -242,33 +242,39 @@ Every weapon type has an attack animation group and a suffix for the movement an
|
||||||
For example, long blades use ``weapononehand`` attack animation group, ``idle1h`` idle animation group, ``jump1h`` jumping animation group, etc.
|
For example, long blades use ``weapononehand`` attack animation group, ``idle1h`` idle animation group, ``jump1h`` jumping animation group, etc.
|
||||||
This is the full table of supported animation groups:
|
This is the full table of supported animation groups:
|
||||||
|
|
||||||
+---------------+-------------------+------------------+----------------------+-----------------------+
|
+---------------+-------------------+------------------+----------------------+-----------------------+-----------------------+
|
||||||
| Weapon type | Animation group | Movement suffix | Attack (fallback) | Suffix (fallback) |
|
| Weapon type | Animation group | Movement suffix | Attack (fallback) | Suffix (fallback) | Attach bone |
|
||||||
+===============+===================+==================+======================+=======================+
|
+===============+===================+==================+======================+=======================+=======================+
|
||||||
| Short blade | shortbladeonehand | 1s | weapononehand | 1h |
|
| Short blade | shortbladeonehand | 1s | weapononehand | 1h | Weapon Bone |
|
||||||
+---------------+-------------------+------------------+----------------------+-----------------------+
|
+---------------+-------------------+------------------+----------------------+-----------------------+-----------------------+
|
||||||
| Long blade 1H | weapononehand | 1h | | |
|
| Long blade 1H | weapononehand | 1h | | | Weapon Bone |
|
||||||
+---------------+-------------------+------------------+----------------------+-----------------------+
|
+---------------+-------------------+------------------+----------------------+-----------------------+-----------------------+
|
||||||
| Long blade 2H | weapontwohand | 2c | | |
|
| Long blade 2H | weapontwohand | 2c | | | Weapon Bone |
|
||||||
+---------------+-------------------+------------------+----------------------+-----------------------+
|
+---------------+-------------------+------------------+----------------------+-----------------------+-----------------------+
|
||||||
| Blunt 1H | bluntonehand | 1b | weapononehand | 1h |
|
| Blunt 1H | bluntonehand | 1b | weapononehand | 1h | Weapon Bone |
|
||||||
+---------------+-------------------+------------------+----------------------+-----------------------+
|
+---------------+-------------------+------------------+----------------------+-----------------------+-----------------------+
|
||||||
| Blunt 2H | blunttwohand | 2b | weapontwohand | 2c |
|
| Blunt 2H | blunttwohand | 2b | weapontwohand | 2c | Weapon Bone |
|
||||||
+---------------+-------------------+------------------+----------------------+-----------------------+
|
+---------------+-------------------+------------------+----------------------+-----------------------+-----------------------+
|
||||||
| Axe 1H | bluntonehand | 1b | weapononehand | 1h |
|
| Axe 1H | bluntonehand | 1b | weapononehand | 1h | Weapon Bone |
|
||||||
+---------------+-------------------+------------------+----------------------+-----------------------+
|
+---------------+-------------------+------------------+----------------------+-----------------------+-----------------------+
|
||||||
| Axe 2H | blunttwohand | 2b | weapontwohand | 2c |
|
| Axe 2H | blunttwohand | 2b | weapontwohand | 2c | Weapon Bone |
|
||||||
+---------------+-------------------+------------------+----------------------+-----------------------+
|
+---------------+-------------------+------------------+----------------------+-----------------------+-----------------------+
|
||||||
| Blunt 2H wide | weapontwowide | 2w | weapontwohand | 2c |
|
| Blunt 2H wide | weapontwowide | 2w | weapontwohand | 2c | Weapon Bone |
|
||||||
+---------------+-------------------+------------------+----------------------+-----------------------+
|
+---------------+-------------------+------------------+----------------------+-----------------------+-----------------------+
|
||||||
| Spear | weapontwowide | 2w | weapontwohand | 2c |
|
| Spear | weapontwowide | 2w | weapontwohand | 2c | Weapon Bone |
|
||||||
+---------------+-------------------+------------------+----------------------+-----------------------+
|
+---------------+-------------------+------------------+----------------------+-----------------------+-----------------------+
|
||||||
| Bow | bowandarrow | bow | | 1h |
|
| Bow | bowandarrow | bow | | 1h | Weapon Bone Left |
|
||||||
+---------------+-------------------+------------------+----------------------+-----------------------+
|
+---------------+-------------------+------------------+----------------------+-----------------------+-----------------------+
|
||||||
| Crossbow | crossbow | crossbow | | 1h |
|
| Crossbow | crossbow | crossbow | | 1h | Weapon Bone |
|
||||||
+---------------+-------------------+------------------+----------------------+-----------------------+
|
+---------------+-------------------+------------------+----------------------+-----------------------+-----------------------+
|
||||||
| Thrown | throwweapon | 1t | | 1h |
|
| Thrown | throwweapon | 1t | | 1h | Weapon Bone |
|
||||||
+---------------+-------------------+------------------+----------------------+-----------------------+
|
+---------------+-------------------+------------------+----------------------+-----------------------+-----------------------+
|
||||||
|
|
||||||
|
Note that bows can be attached to the "Weapon Bone Left" bone if it is present in shooter's skeleton, and if it is not, "Weapon Bone" is used as a fallback.
|
||||||
|
|
||||||
|
Also it is possible to add a "Bip01 Arrow" bone to actor skeletons. In this case OpenMW attaches arrows to this bone instead of ArrowBone in the bow mesh.
|
||||||
|
Such approach allows to implement better shooting animations (for example, beast races have tail, so quivers should be attached under different angle and
|
||||||
|
default arrow fetching animation does not look good).
|
||||||
|
|
||||||
.. _`Graphic Herbalism`: https://www.nexusmods.com/morrowind/mods/46599
|
.. _`Graphic Herbalism`: https://www.nexusmods.com/morrowind/mods/46599
|
||||||
.. _`OpenMW Containers Animated`: https://www.nexusmods.com/morrowind/mods/46232
|
.. _`OpenMW Containers Animated`: https://www.nexusmods.com/morrowind/mods/46232
|
||||||
|
|
Loading…
Reference in a new issue