Multiplayer Game
•
Implement the character movement:
protected:
void MoveForward(float value);
void MoveRight(float value);
MyCharacter.h
void AMyCharacter::MoveForward(float value){
AddMovementInput(GetActorForwardVector(), value);
MyCharacter.cpp
}
void AMyCharacter::MoveRight(float value){
AddMovementInput(GetActorRightVector(), value);
}
void AMyCharacter::SetupPlayerInputComponent(UInputComponent*
PlayerInputComponent){
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis("MoveForward", this,
&
AMyCharacter::MoveForward);
PlayerInputComponent->BindAxis("MoveRight", this,
AMyCharacter::MoveRight);
&
}