Hey, im an novice programmer and i was making a character that jumps on the direction of the inputaxis of WASD (Sort of like the Scout from TeamFort2) and for some reason while i was testing the multiplayer, i found that only one player out of all other players can actually get something that isnt 0 from the ForwardAxis and RightAxis Variables. any help would be awsome. (Header file included)
TestCharacter.h (1.2 KB)
(Yes i checked if the names of the bindaxis is correct)
// the variables for the input axis (Global variables
float ForwardAxis;
float RightAxis;
// Player input component setup
void ATestCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &ATestCharacter::CustomJump);
PlayerInputComponent->BindAxis("ForwardInput", this, &ATestCharacter::MoveForward_Implementation);
PlayerInputComponent->BindAxis("RightInput", this, &ATestCharacter::MoveRight_Implementation);
PlayerInputComponent->BindAxis("MouseX", this, &ATestCharacter::LookAround);
PlayerInputComponent->BindAxis("MouseY", this, &ATestCharacter::LookUp);
}
// the directional movement, the ForwardAxis and RightAxis are set here
void ATestCharacter::MoveRight_Implementation(const float Value)
{
const FVector RightVector = GetActorRightVector();
AddMovementInput(RightVector, Value, false);
RightAxis = Value;
}
void ATestCharacter::MoveForward_Implementation(const float Value)
{
const FVector ForwardVector = GetActorForwardVector();
AddMovementInput(ForwardVector, Value, false);
ForwardAxis = Value;
}
// the actual jumping process
void ATestCharacter::CustomJump_Implementation()
{
const FVector ForwardVector = GetActorForwardVector();
const FVector RightVector = GetActorRightVector();
const float X = ((ForwardVector.X * ForwardAxis) + (RightVector.X * RightAxis)) * GetCharacterMovement()->JumpZVelocity;
const float Y = ((ForwardVector.Y * ForwardAxis) + (RightVector.Y * RightAxis)) * GetCharacterMovement()->JumpZVelocity;
FVector const Velocity = FVector(X, Y, GetCharacterMovement()->JumpZVelocity);
LaunchCharacter(Velocity, true, true);
}