I’ve created the custom movement component and initialized it with this:
ACndCharacter_Master::ACndCharacter_Master(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer
.SetDefaultSubobjectClass<UCndComp_Character_Move>(TEXT("CO_CharMove"))
)
GetCharacterMovement()->DestroyComponent();
CO_CndCharacter_Move = CreateDefaultSubobject<UCndComp_Character_Move>(CndKN_CompNames.Character.Move);
if (CO_CndCharacter_Move)
{
CO_CndCharacter_Move->UpdatedComponent = CO_CndCharacter_Capsule;
}
Yes, it inherits from CharacterMovementComponent.
UCLASS(Blueprintable, ClassGroup = (CndComponents_Character), meta = (BlueprintSpawnableComponent))
class MY_API UCndComp_Character_Move : public UCharacterMovementComponent
UCndComp_Character_Move::UCndComp_Character_Move()
{
PrimaryComponentTick.bCanEverTick = true;
}
And these don’t do anything.
void ACndCharacter_Master::BPF_Character_Input_Move(const FRotator YawRotation, const FVector2D MovementVector)
{
AddMovementInput(FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y), MovementVector.X);
AddMovementInput(FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X), MovementVector.Y);
}
So, FYI: I can look, but I can’t move.
How I can make the engine use my own movement component, to make my character move?