Enhanced Input Axis3D movement - Gamepad Problem

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);
	}
}

Found the solution! By default gamepad input had “Scalar” modifier. This caused X-Y values to multiplied and range between -50 to 50 instead of -1 to 1. When X and Y scaled too much, I think Z value stayed small compared to other two and didn’t affect. Not sure how exactly.

TLDR: remove Scalar Modifier

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.