I am trying to move a Top Down camera with Motion Tilt Controls (For a mobile phone). The device orientation is set to Landscape mode. This makes turning the phone left and right move forward, as this is the X Axis. I want to change this behaviour to the Y Axis.
I Added a Swizzle Input Axis Values modifier to the Context, and set it to YXZ, however the input no longer fires when moving the phone in any direction.
I am using Enhanced Input , and have individual functions for each direction of movement, and they are connected to their corresponding InputActions, e.g. IA_MoveFoward. This is one of the C++ functions:
void ACameraPawn::MoveCameraForward(const FInputActionValue& Value)
{
if (Controller != nullptr)
{
/** Input is a float as it moves along a single Axis. **/
const float MovementVector = Value.Get<float>();
/** find out which way is forward **/
const FRotator Rotation = Controller->GetControlRotation();
const FRotator YawRotation(0, Rotation.Yaw, 0);
/** Get direction vectors. **/
const FVector ForwardDirection = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
if (MovementVector > 0.0f)
{
AddMovementInput(ForwardDirection, MovementVector);
}
}
}
Any ideas on why the Swizzle is not working? Or how to change these Axis around?
EDIT: So Swizzle is for a FVector only, will swap the X and Y, can’t be used per Axis