I added event to animation of dismounting from horse. Event is named "Unlink" and put there number eg. 688.
Then I created table with bindings:
class HumanCommandScript_HorsePlrST { void HumanCommandScript_HorsePlrST(Human pHuman) { HumanAnimInterface hai = pHuman.GetAnimInterface(); m_CmdStartControlHorse = hai.BindCommand("CMD_Vehicle_GetIn"); m_CmdStopControlHorse = hai.BindCommand("CMD_Vehicle_GetOut"); m_VarLook = hai.BindVariableBool("Look"); m_VarRaised = hai.BindVariableBool("Raised"); m_VarVehicleType = hai.BindVariableInt("VehicleType"); m_VarMovementDirection = hai.BindVariableFloat("MovementDirection"); m_EventUnlink = hai.BindEvent("Unlink"); } // TAnimGraphCommand m_CmdStartControlHorse; //! command to start swimming // TAnimGraphVariable m_VarSpeed; //! float variable - 0,1,2,3 speed // TAnimGraphVariable m_VarDirection; //! float variable - angle // TAnimGraphTag m_TagIsSwimming; //! int m_CmdStartControlHorse; //! command to start swimming int m_CmdStopControlHorse; //! command to start swimming TAnimGraphVariable m_VarLook; TAnimGraphVariable m_VarRaised; TAnimGraphVariable m_VarVehicleType; TAnimGraphVariable m_VarMovementDirection; TAnimGraphEvent m_EventUnlink; }
Then in my scripted command in PrePhysUpdate did this:
override void PrePhysUpdate(float pDt) { if (PrePhys_IsEvent(m_Table.m_EventUnlink)) { m_pPlayer.UnlinkFromLocalSpace(); Print("EVENT UNLINK"); } }
but it does not work.
My usecase is call unlink when is player entityposition far from horse, like is done when player is get off vehicle.