The logic in your RootMotionCharacter_BP EventGraph doesn’t look right. How about creating 2 new float variables called UserForward and UserRight. Simply set UserForward to the AxisValue of the InputAxis MoveForward node, and do the same for the UserRight. Ok, so now those 2 variables always reflect what the user is trying to do. After setting EITHER UserForward or UserRight, have the exit point of both of those Set nodes merge together into the same input of your Cast node. From there, implement branching logic that does this:
If Moving is False, set MoveForward=UserForward, and MoveRight=UserRight.
If Moving is True, and either UserForward!=0 or UserRight!=0, set MoveForward=UserForward, and MoveRight=UserRight.
If Moving is True, and both UserForward==0 and UserRight==0, don’t modify either MoveForward nor MoveRight at all. No “Set” nodes for MoveForward and MoveRight in this condition.
Actually, we’ll still have a problem with the above. I think you’re going to need to add a bool variable called HoldMovement, which defaults to False. When you detect that “Moving is True, and both UserForward==0 and UserRight==0”, then you’d set HoldMovement to True. When HoldMovement is True, you will need to do the “don’t modify either MoveForward nor MoveRight at all” thing regardless of the first two conditions. Then, when you’ve received the notification that you’ve returned to Idle, you’ll need to set HoldMovement back to False.
Have you ever set this up before? Definitely a challenging setup.
Setting last known run direction value so it checks your current run direction with that value to play the correct stop or something along these lines.
I tried setting UserForward and UserRight values during this notify but it did not set it like it did the direction of the player…interesting…
Basically MoveForward or MoveRight will still have a value output…I checked through Print String.
But the problem is it won’t keep running at 45 degree angles, like if I hold WD and then let go of WD…it will either revert to just W or just D…this would mean for an improper stop animation because if you are running at WD (45 forward right) it wouldn’t play that animation it would play forward or right.
Is there anyway to revert MoveForward and MoveRight back to 0 so that I can enter Idle state? After the stop animation plays my guy is forced back into start, then locomotion, then stop. I can hold WASD to stay in locomotion but I can’t change directions when the guy has skipped his Idle phase!
Sorry, I’ve been really busy. From your latest video, it’s looking really good.
The case where Stops is in progress and you then press WASD is a difficult case to handle. The easiest thing to do is to handle it the way we’re doing now, so that if WASD is released we enter Stops and let it transition all the way through to Idle before Starts is allowed to be entered, even if WASD is pressed again while inside Stops.
But that may feel sluggish to the player. They may want to start running again the instant Stops is entered. If WASD is pressed while in Stops, it might be possible to transition from Stops into Starts, but begin the Start animation at a time other than 0, but this may prove difficult.
Another thing you could try is to add a transition from Stops to Locomotion, so that if WASD is pressed while inside Stops, you bail Stops and transition back to Locomotion. You may sometimes see some stuttering footwork, but maybe it’ll look ok.
If it’s going from Idles to Starts, then MoveRight or MoveForward must not be 0, which means there’s a problem in your event graph. I don’t have time to look through your event graph logic, but you can try printing out the values of MoveRight and MoveForward and confirm that one or both of them is not 0 when Idle is reached.
I think UE4’s evaluation of the Idles to Starts transition rule is performed before the Stops to Idles transition has completed. Try modifying the Idles to Starts transition rule so that it does this:
Allow Transition if ( (MoveForward != 0) OR (MoveRight != 0) ) AND (NOT Moving).
We want to make sure we have completely left the Stops state. When we leave the Stops state, our notification should set Moving to False and should set MoveForward and MoveRight to 0.
The values never change even though I set them to 0
They remain at last WASD value once I hit stops
Once I tap WASD it will never return back to idles. It will skip idles once the stop plays and continue to play the start
IsMoving? never hits false after this time
Do you know how I can speed up my turn-in-place animation when my yaw of the camera is too much?
I want my player to always face forward and not have the camera be able to look behind him if the player spins the camera around the character too much. With the animation speeding up the character can always look forward!
and add
stand to crouch/crouch to stand
animations?
I have a problem blending these to and from idle.
Were you able to get things working? I’ve been slammed, so not much time available to help. Regarding speeding up the animation, do you know about the Play Rate pin available on the animation nodes in your anim BP? They’re not exposed by default, but if you click on the node, you’ll see a checkbox that says “(As pin) Play Rate”. If you check it, the Play Rate pin will appear on your node. You can put this on your turn animations, and connect it to a float variable that defaults to 1.0. Then, in your event graph, you can increase the value for faster turns. Hope this helps.
Also, is there a way to exit these animation phases when I press WASD again? (i.e. stops, going to locomotion when WASD pressed)
or stop them? (i.e. starts, going into idle when WASD released)