Unexpected Movement Behavior

Hi Community

I am having an issue where I believe the X-axis and Y-axis are not as I expect. When I move my character up my updating the actors position’s Y value, my character will move right or left instead of up or down.

I suspect there is an issue here with how the camera is orientated. I tried rotating the camera by 90 degrees on the X-axis, which will resolved the Y-axis issue, but my X-axis directions become inverses (+X value results in the pawn moving left stead of right). Below is the code for the movement and the camera set up. Any guidance on how to properly handle this issue would be much appreciated!

Camera Set Up:
// Create a camera boom attached to the root (capsule)
USpringArmComponent* CameraBoom = CreateDefaultSubobject(TEXT(“CameraBoom”));
CameraBoom->TargetArmLength = 500.0f;
CameraBoom->SocketOffset = FVector(0.0f, 0.0f, 0.0f);
CameraBoom->bAbsoluteRotation = true;
CameraBoom->bDoCollisionTest = false;
CameraBoom->CameraRotationLagSpeed = false;
CameraBoom->bUsePawnControlRotation = false;
CameraBoom->SetWorldRotation(FRotator(-90.0f, 0.0f, 0.0f));

	// Create an orthographic camera (no perspective) and attach it to the boom
	TopViewCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("TopViewCamera"));
	TopViewCameraComponent->ProjectionMode = ECameraProjectionMode::Orthographic;
	TopViewCameraComponent->OrthoWidth = 2048.0f;
	TopViewCameraComponent->bUsePawnControlRotation = false;
	TopViewCameraComponent->SetupAttachment(CameraBoom, USpringArmComponent::SocketName);
	TopViewCameraComponent->SetWorldRotation(FRotator(-90.0f, 0.0f, 0.0f));

Movement function called in Pawn Tick():

void ABasePlayerPawn::MoveHero(float const& deltaTime)
	FVector pos = GetActorLocation();

	UE_LOG(LogTemp, Warning, TEXT("Move Player (%f, %f)"),  HeroInput.MovementInput.X,  HeroInput.MovementInput.Y);
	pos.X += HeroInput.MovementInput.X * MoveSpeed * deltaTime;
	pos.Y += HeroInput.MovementInput.Y * MoveSpeed * deltaTime;


Based on what you provided, I think your problem is that your world is oriented wrong. Height is the Z axis. You put your floor with no rotation. You put the camera at a position with a larger Z value than the floor. And you rotate the camera -90 on the Y axis. Then the X and Y values will work properly.

But I just told you. Clear any rotation from your floor. Put the camera at (0, 0, 2000) or something like that and set its rotation to (0, -90, 0). Then everything in your world should be oriented to match the floor. It’s the exact same setup you’d have in a FPS or third-person game. The only difference is the camera position.

Yeah, The world is definitely oriented wrong. but I am not sure howto adjust the world to model X being left to right and Y being Up and Down. My Goal Is be “Top Down” which is to rotate the camera so that camera is sitting on a positive Z value and looking down at the XY plane.

ah, I see. Sorry, I didn’t quite understand your first response. Thank you for the help!

No problem. Let me know if you still have any issues. GL!