Hello!
I am currently working on a sprinting system for UE4, which is written in C++, and I have a problem with one of the animations.
The sprinting system works perfectly with the increase of the speed, the code goes as following (This is a thirdperson UE4 project).
Header:
UFUNCTION(Reliable, Server, withValidation)
void StartSprint();
UFUNCTION(Reliable, Server, withValidation)
void EndSprint();
CPP:
bool AMyGameCharacter::StartSprint_Validate()
{
return true;
}
void AMyGameCharacter::StartSprint_Implementation()
{
CharacterMovement->MaxWalkSpeed = 600.0f;
}
bool AMyGameCharacter::EndSprint_Validate()
{
return true;
}
void AMyGameCharacter::EndSprint_Implementation()
{
CharacterMovement->MaxWalkSpeed = 400.0f;
}
Now, this is the part where the problem occurs. I use a Blendspace 1D to handle my three animations: Idle, Walk and Sprint.
If I test with 2 clients, both of the clients can see: The idle animation and the walk animation. For some reason, when I hold down my key to sprint, the client which should have been sprinting, sees the walking animation as “lagging” (it is not switching over to the sprinting animation), while the second client sees the sprinting animation perfectly.
I also did a test with three clients at once, with the following result:
Client 1 was sprinting.
Client 2 and 3 was observing.
Client 1 could only see the walking animation as lagging, while client 2 and 3 was capable of observing the sprinting animation.
I do not believe that it is a problem with the float for speed, otherwise it would not register that the client should switch between idling and walking. I would be very grateful to have some help on this issue.