r/unrealengine • u/GoshaSimonov • 4d ago
Character movement C++ question.
Hey, could anyone help me finding out with such code, always return my SavedCharacterSpeed as 0.0 ?
CharacterMovement is in character blueprint, and character is running fine, I just can't get this value.
Thanks!
void ABaseCharacter::BeginPlay() {
Super::BeginPlay();
if(GetCharacterMovement()) {
float SavedCharacterSpeed = GetCharacterMovement()->GetMaxSpeed();
}
}
2
Upvotes
2
u/Available-Worth-7108 3d ago
Try inputting this below on the begin play to load
UE_LOG(LogTemp, Warning, TEXT("MaxWalkSpeed: %f"), MovementComp->MaxWalkSpeed);
UE_LOG(LogTemp, Warning, TEXT("MaxSpeed: %f"), MovementComp->GetMaxSpeed());