Download

Motion input

Hi, APlayerController::GetMotionInputState always gives 0-vectors, no matter how I accelerate and rotate my phone. I have a Samsung Galaxy S4. My code:



void AMainPawn::TickMotionInput(float Delta)
{
	APlayerController* const PC = Cast<APlayerController>(Controller);

	FVector Tilt;
	FVector RotationRate;
	FVector Gravity;
	FVector Acceleration;

	PC->GetInputMotionState(Tilt, RotationRate, Gravity, Acceleration);

	if (GEngine)
	{
		GEngine->AddOnScreenDebugMessage(-1, 1.f, FColor::Green, Tilt.ToString());
		GEngine->AddOnScreenDebugMessage(-1, 1.f, FColor::Yellow, RotationRate.ToString());
		GEngine->AddOnScreenDebugMessage(-1, 1.f, FColor::Red, Gravity.ToString());
		GEngine->AddOnScreenDebugMessage(-1, 1.f, FColor::Blue, Acceleration.ToString());
	}
}


Fixed it.
I had an Empty touch interface. Chanigng the touch interface to “none” fixed it.

I need to touch once to activate motion input. When I touch near the middle again, I disable it. Can I remove this behaviour?