Hey there, I’m actually researching this class as well!
If you need deep customization, you’ll inevitably have to read its source code.
However, CharacterMovementComponent
is one of the most complex classes in Unreal Engine—the CharacterMovementComponent.cpp
file alone has over 10,000 lines of code.
Here’s a rough breakdown of how it works:
- The movement input vector from the controller is stored.
- Inside
UCharacterMovementComponent::TickComponent()
, this input is processed. - It gets passed into
UCharacterMovementComponent::ControlledCharacterMove()
. - Then it goes into
UCharacterMovementComponent::PerformMovement()
. - Finally, it reaches
UCharacterMovementComponent::StartNewPhysics()
, which is a core function — I highly recommend reading its source code.
This function handles various movement states like PhysWalking
, PhysFalling
, and PhysFlying
.
But be careful—these states can switch between each other, sometimes even multiple times within a single tick.
I think you might need to override UCharacterMovementComponent::PhysWalking()
or UCharacterMovementComponent::PhysFalling()
.
You can create a subclass of UCharacterMovementComponent
, override these functions, and instead of calling the parent class’s implementation directly, copy the original implementation and modify it as needed for deep customization.
Hope this helps!