Hello! I was following a locomotion tutorial on YouTube. Everything started to fall apart when I got to this part. In the series, BlueprintThreadSafeUpdateAnimation
and PropertyAccess
are being used, and the overall locomotion system resembles Lyra’s locomotion system.
The issue is when transitioning to the Start state, the function bound to OnBecomeRelevant
, SetUpStartAnims
, gets outdated values, or at least LocomotionDirection
is not correct. The Start
state needs to select its animation based on LocomotionDirection
. The LocomotionDirection
variable is set to Forward by default. So when you go, for example, to the left, PropertyAccess
in SetUpStartAnims
returns the previous value - Forward - so most of the time the wrong animation is selected. The author says it’s a single-frame delay and that he could not understand the source of the problem, saying Lyra did the same thing, but for some reason, this doesn’t work here. He solved it by checking if the current sequence is the right sequence every frame, OnUpdate
.
This user, Pulciu, in the comment section, solved it by using the PreviousAcceleration2D, not the current Acceleration2D, length to determine if accelerating. Transition to Start happens when IsAccelerating is true.
For me, it’s somewhat of a workaround. It did work, but I gather the user decided not to use a hip-aware system, meaning HipFacingDirection
changes based on DesiredHipFacingDirections
. It’s preferable to face the hip to the desired when in Start, so SetHipFacingAsDesired was bound to OnBecomeRelevant of LocomotionLayer_Start
.
So now, even though we solved the problem with LocomotionDirection
, now HipFacingDirection
is out of date. I think the Start
state “screened” the variables before setting HipFacingDirection
.
This problem seems so trivial, but I couldn’t find any solution. Maybe I’m missing something.
I thought maybe by setting updating LocomotionDirection before checking if accelerating would do the trick, but changing the order didn’t help.