Hello, I have a floating camera that moves in XY and also in Z axis simultaneously. I can move in 3D using WASD and EQ but it is not the same with gamepad. On the gamepad, while I am moving in XY, feels like it doesn’t get Z-axis input. When I am stationary I can go up and down but somehow not working when there’s XY movement. I’m confused.
Action mapping should be correct because I did the same for R2-L2 as it is in E-Q. Maybe I should do something different for the gamepad?
void APhotoCamera::Move(const FInputActionValue& Value)
{
// input is a Vector
FVector MovementVector = Value.Get<FVector>();
if (Controller != nullptr)
{
// find out which way is forward
FRotator Rotation = Controller->GetControlRotation();
// get forward vector
FVector ForwardDirection = FRotationMatrix(Rotation).GetUnitAxis(EAxis::X);
// get right vector
FVector RightDirection = FRotationMatrix(Rotation).GetUnitAxis(EAxis::Y);
// ensure movement is only on XY axis
ForwardDirection.Z = 0.f;
RightDirection.Z = 0.f;
// create an up direction vector in world space
FVector UpVector = FVector::UpVector;
// add movement
AddMovementInput(ForwardDirection, MovementVector.Y);
AddMovementInput(RightDirection, MovementVector.X);
// add movement in the world Z axis
AddMovementInput(UpVector, MovementVector.Z);
}
}