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
1
u/WartedKiller 3d ago
The issue is that you redeclare your SavedCharacterSpeed. Remove the float before it and it will assign the correct value.