From d587c9a6928c236b609013764b3574066b656552 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Sun, 13 Mar 2016 22:17:55 +0100 Subject: [PATCH] Fixed first person strafe animation --- .../Engine/Input/FirstPersonInputController.h | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/include/Engine/Input/FirstPersonInputController.h b/include/Engine/Input/FirstPersonInputController.h index c159e113..67e7270e 100644 --- a/include/Engine/Input/FirstPersonInputController.h +++ b/include/Engine/Input/FirstPersonInputController.h @@ -212,6 +212,33 @@ bool FirstPersonInputController::OnCommand(const Events::InputComm m_EventBroker->Publish(aeb); } } + + + EntityWrapper firstPersonModel = m_PlayerEntity.FirstChildByName("Hands"); + if (firstPersonModel.Valid()) { + if (val > 0) { // Walk/Run + if (!m_Crouching) { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "Run"; + aeb.RootNode = firstPersonModel; + aeb.SingleLevelBlend = true; + aeb.Start = true; + m_EventBroker->Publish(aeb); + } + } else if (val < 0) { // Walk/run Backwards + if (!m_Crouching) { + Events::AutoAnimationBlend aeb; + aeb.Duration = 0.1; + aeb.NodeName = "Run"; + aeb.RootNode = firstPersonModel; + aeb.SingleLevelBlend = true; + aeb.Start = true; + aeb.Reverse = true; + m_EventBroker->Publish(aeb); + } + } + } } } }