Blueprint Creating Custom Character Movement Component
Purpose and Use
How to create a custom movement mode so the character can climb a ladder.
I tried two separate times to figure out how to use a custom character movement mode in blueprints with no success and ended up just using a workaround with the existing preset modes. There's very little documentation about how to do this in blueprints and the concept is a bit different using Enumerated types. I finally figured it out so I decided to do a quick tutorial to hopefully visually bridge the gap of understanding for someone else. If someone see's a better way to do this then please update.
- You know how to create and edit Persona blueprints.
Setup in Character Blueprint - Event Graph
Event Graph - Triggering a Custom Movement Mode Change
"Calculate Ladder Climbing Position" - Inside macro
"Player Direction Macro" - Player Direction
- The "Climbing Ladder" variable in the images is a Byte which I happen to have set to 7 just for the sake of being in order of the different EMovementMode variations already existing although I think you can start at 0.
- "Can The Player Touch The Ground" is doing a Line Trace to see if the character is close to the ground. (Optional)
- Using Calc Velocity will affect all the other movement modes so be aware but I adjusted Delta time to 1 to speed up offsets and Braking Deceleration to 40 to give a bit of follow through
Setup in Animation Blueprint - AnimGraph
Transition Rule - Moving from Idle to Climbing state within the AnimGraph of the Animation Blueprint
Climbing State - Looping climbing animation using play rate based on the speed of velocity to keep feet aligned to ladder
- I had to use Cast to Character in the event graph of the Animation blueprint to transfer the "Climbing Ladder" byte variable over from the Character Blueprint.
- Some of the wiring like "Getting Direction" could be put into a Macro function