This isn’t a full tutorial, and I’m not an expert, but I noticed this knowledge wasn’t really collected together anywhere, so I’m putting something together here. Please shout if there’s any holes or mistakes.
The CharacterMovementComponent that comes with the third-person starter kit has several movement modes you can switch between using the Set Movement Mode node. Walking, falling, swimming, and flying are all supported out-of-the-box, but there’s also a “Custom” option in the dropdown. How do you implement a new custom movement mode?
First, limitations: I’ve not found a way to make networkable custom movement modes via blueprint. I think I need to be reusing the input from Add Movement Input, but I’m not yet sure how. Without doing that, the server has no idea how to do your movement.
When you set a new movement mode, the OnMovementModeChanged event (which is undocumented??) gets fired:
At this point you can toggle state or meshes, zero velocity, and other things you might want to do when entering and leaving your custom mode.
The (also undocumented) UpdateCustomMovement event will fire when you need to do movement:
From here you can read your input axis and implement your behaviours. You can just use the delta and Set Actor Location, but there’s also the Calc Velocity node which can help implement friction and deceleration for you.
To return to normal movement again, I’ve found it’s safest to use Set Movement Mode to enter Falling, and let the component sort itself out, but ymmv there.
Hope someone finds this helpful.
I started a new project for extending UTF.
It has the LogAssertEx class that offers a more advanced API than what you get out of the box.
Feel free to check it out: https://github.com/liortal53/UnityTestingExtensions
Thanks, that looks like a good extension!