Skip to content

๐ŸŽฏ Tutorial: Basic Gyro Aim Implementation

rafaelvaloto edited this page Jun 17, 2026 · 4 revisions

This guide covers how to enable and apply gyroscope data to control the camera using the controller sensors.

๐ŸŽฎ 1. Enable the Gyroscope

Before receiving any sensor data, the gyroscope must be initialized.

  • On the BeginPlay event, call the EnableGyroscopeValues node from your SonyGamepadSensorsProxy.
  • Set the target ControllerId (default is 0) and ensure bEnableGyroscope is set to true.
Gyro_Aim_Tutorial_On

๐Ÿ”„ 2. Gyro Reset and Recalibration

It is standard practice to allow the player to reset the camera and pause the gyro input to reposition their hands physically.

  • Create an input action for resetting (e.g., IA_Gyro_Reset).
  • On the Started trigger, set a ResetGyro boolean to true and call the ResetGyroOrientation function.
  • On the Completed trigger, set the ResetGyro boolean back to false.

๐ŸŽฏ 3. Applying Camera Movement

Use the continuous vector data from the gyroscope to drive the camera.

  • On the Triggered pin of your IA_Gyro input action, store the action value into a local variable (e.g., LastVectorGyro).
  • Add a Branch node to verify that the Not_PreBool of your ResetGyro variable is true (meaning the player is not currently holding the reset button).
  • Pitch (Up/Down): Extract the Y-axis from the gyro vector, negate the float (using NegateFloat), and connect it to the AddControllerPitchInput node.
  • Yaw (Left/Right): Extract the Z-axis from the gyro vector and connect it directly to the AddControllerYawInput node.
Gyro_Aim_Tutorial_Actions

๐Ÿ“Š 4. Additional Sensors (Optional)

If your project requires raw physical data, whether for UI debug information or procedural animations:

  • Map IA_Accel to capture and store the accelerometer vector.
  • Map IA_Inclination to capture and store the device's tilt/inclination vector.
image

๐Ÿ“ฅ Example Project Download

To speed up your implementation, you can review the functional setup by downloading the demo project.

๐Ÿ“‚ File and Folder Structure

When downloading the project, you will find the assets following this exact directory structure:

  • Character and Code: /Content/InfimaGames/FreeFPSTemplate/Core/BP_Character.BP_Character
  • Input Actions: /Content/InfimaGames/FreeFPSTemplate/Data/Sensors

โญ Credits

This tutorial project uses parts of the material https://www.fab.com/listings/6a0af880... created by Infima Games, which is licensed under the Creative Commons Attribution 4.0 International license. The original material has been modified to integrate gyroscope rotation reading.

Important/Additional Notes: Includes the "Low-Poly AAC Honey Badger" model (https://skfb.ly/6SMsu) by TastyTony which is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/b....

Requires Blender version 4.0.2 or higher, can be downloaded here


Beack to the home

Clone this wiki locally