Updated 3rd person and 1st person animation trees for assault to allow for third person weapon animations
This commit is contained in:
@@ -72,7 +72,7 @@ void AssaultWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo&
|
||||
const float& movementSpeed = cPlayer["MovementSpeed"];
|
||||
float speed = glm::length((const glm::vec3&)cPhysics["Velocity"]);
|
||||
float animationWeight = glm::min(speed, movementSpeed) / movementSpeed;
|
||||
EntityWrapper rootNode = wi.FirstPersonEntity.FirstParentWithComponent("Model");
|
||||
EntityWrapper rootNode = wi.FirstPersonEntity;
|
||||
if (rootNode.Valid()) {
|
||||
EntityWrapper blend = rootNode.FirstChildByName("MovementBlend");
|
||||
if (blend.Valid()) {
|
||||
@@ -125,7 +125,20 @@ void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi)
|
||||
reloadTimer = reloadTime;
|
||||
|
||||
// Play animation
|
||||
playAnimationAndReturn(wi.FirstPersonEntity, "BlendTreeAssaultWeapon", "Reload");
|
||||
playAnimationAndReturn(wi.FirstPersonEntity, "ActionBlend", "Reload");
|
||||
// Third person anim
|
||||
Events::AutoAnimationBlend b1;
|
||||
b1.RootNode = wi.ThirdPersonPlayerModel;
|
||||
b1.NodeName = "Reload";
|
||||
b1.Restart = true;
|
||||
b1.Start = true;
|
||||
m_EventBroker->Publish(b1);
|
||||
Events::AutoAnimationBlend b2;
|
||||
b2.RootNode = wi.ThirdPersonPlayerModel;
|
||||
b2.NodeName = "MovementBlend";
|
||||
b2.AnimationEntity = wi.ThirdPersonPlayerModel.FirstChildByName("AssaultWeaponBlend").FirstChildByName("Reload");
|
||||
m_EventBroker->Publish(b2);
|
||||
|
||||
// Spawn explosion effect
|
||||
if (wi.FirstPersonEntity.Valid()) {
|
||||
if (IsClient) {
|
||||
@@ -233,7 +246,19 @@ void AssaultWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi
|
||||
}
|
||||
|
||||
// Play animation
|
||||
playAnimationAndReturn(wi.FirstPersonEntity, "BlendTreeAssaultWeapon", "Fire");
|
||||
playAnimationAndReturn(wi.FirstPersonEntity, "ActionBlend", "Fire");
|
||||
// Third person anim
|
||||
Events::AutoAnimationBlend b1;
|
||||
b1.RootNode = wi.ThirdPersonPlayerModel;
|
||||
b1.NodeName = "Fire";
|
||||
b1.Restart = true;
|
||||
b1.Start = true;
|
||||
m_EventBroker->Publish(b1);
|
||||
Events::AutoAnimationBlend b2;
|
||||
b2.RootNode = wi.ThirdPersonPlayerModel;
|
||||
b2.NodeName = "MovementBlend";
|
||||
b2.AnimationEntity = wi.ThirdPersonPlayerModel.FirstChildByName("AssaultWeaponBlend").FirstChildByName("Fire");
|
||||
m_EventBroker->Publish(b2);
|
||||
|
||||
// Sound
|
||||
Events::PlaySoundOnEntity e;
|
||||
|
||||
Reference in New Issue
Block a user