I'm trying to add aiming by gyroscope to my game.

In the controller's module I parsed gyro/accel data and get the processed axis values, that I send into engine:

                    FVector(Rotation.Pitch, Rotation.Yaw, Rotation.Roll),
                    FVector::RadiansToDegrees(FVector(ControllerState.PadData.angularVelocity.x, ControllerState.PadData.angularVelocity.y, ControllerState.PadData.angularVelocity.z)),
                    FVector(0, 0, 0),
                    FVector(ControllerState.PadData.acceleration.x, ControllerState.PadData.acceleration.y, ControllerState.PadData.acceleration.z),

The values are correct here.

Then I added new Axis mapping "Motion" in Input tab at Project Settings and mapped it to the Motion->Tilt.

In my character controller I binded function to that axis:

void AGamePlayerController::SetupInputComponent()
    InputComponent->BindVectorAxis("Motion", this, &AGamePlayerController::MotionInput);

But in the handler function the Tilt (and other axises too) is always set to zero.

void AGamePlayerController::MotionInput(FVector Tilt)
    UE_LOG(LogTemp, Warning, TEXT("Tilt: %f;%f;%f"), Tilt.X, Tilt.Y, Tilt.Z);

How to correctly pass the motion data from the Controller Module to axis binding handler? Did I miss something?



You must log in to answer this question.

Browse other questions tagged .