skip to content

Creating Player Locomotion in Unreal Engine

/ 3 min read

Start

Im learning how to create blueprint procedural locomotion animation in unreal engine, like making a character crouch and procedurally lean!

Progress

Basic Locomotion

I created a character blueprint and added a running animation to it. As I am using the basic third person template, I had the jump option, I then set up Jump, Fall, To Falling, To Land and Land animation to the locomotion movement.

Character Blueprint

Challenge

The challenge I faced was that the character was not smoothly landing, the character did not end the falling animation and start the land animation.

I had to revist each node I created to see if I missed anything. I then realised that I had to set state alias of To Land to connect Falling and Land nodes.

State Alias

This made the falling animation to end and the land animation to start.

Then I learned about priority order, I had to set the priority order of the To Falling -> Falling animation to 2, so that it would not override the Jump animation.

Crouch and Camera zoom out

I learned how to add zoom out camera when the character crouches, I used the add timeline node to create a timeline and changed the Camera boom based on iscrouched boolean. The default camera boom was 400 so on crouch i made it 550, this made the camera zoom out when the character crouches.

Procedural Lean

I added a procedural lean to the character, I used the run animation and created a left and right run animation. Each had a 45 degree tilt. Then created a blend space and added the animations to it. I then used blueprint to create a lean based on character rotation.

Blueprint

Leg Movement, Foot traces, Pelvis offset, Arm motion

I learned a lot here, I learned how to use Get Socket Location node to get the location of the socket, I used this to get the location of the foot socket and used it to trace the ground. I then used the Break Hit Result node to get the location of the hit result and used it to set the location of the foot. I also used the Break Hit Result node to get the normal of the hit result and used it to set the rotation of the foot.

This was way to interesting using sin and cos for the leg movement, I used the sin and cos to set the location of the foot and used the sin to set the rotation of the foot.

Calculating the ideal landing spot, preference for higher spots or lower offsets.

I was following multiple tutorials, but Procedural animation for humans in Unreal Engine 5 helped a lot learning how to to arm motion, rotation limits and much more.

Further learning

I am going to learn how to create more animations and learn how to use the animation blueprint to create a character that can move around the environment. I am also thinking of learning how to create a character that can climb walls and jump over obstacles.