TopDown Engine v5.0
Loading...
Searching...
No Matches
MoreMountains.Tools.MMGyroscope Class Reference

A base gyroscope class, meant to be accessed statically or extended, that exposes a number of gyroscope values. CAREFUL: this will work fine on an iOS or Android build or any other device with a gyroscope, in build. Unity Remote won't send most of these gyro values (as of early May 2026, there's still hope it'll be fixed someday). You can look at the MMGyroParallax class for an example of implementation. More...

Inheritance diagram for MoreMountains.Tools.MMGyroscope:
MoreMountains.Tools.MMGyroParallax

Public Types

enum  TimeScales { Scaled , Unscaled }

Public Member Functions

virtual void CalibrateDebug ()
virtual void GyroscopeDebugInitialization ()

Static Public Member Functions

static void GyroscopeInitialization ()
static void GetValues ()

Public Attributes

bool _TestMode = false
 turn this on if you want to use the inspector to test this camera
float TestXAcceleration = 0f
 the rotation to apply on the x axiswhen in test mode
float TestYAcceleration = 0f
 the rotation to apply on the y axis while in test mode
float TestZAcceleration = 0f
 the rotation to apply on the y axis while in test mode
bool CalibrateButton
bool GyroscopeInitializationBtn

Static Public Attributes

static bool GyroscopeActive = true
 whether or not the gyroscope is active
static TimeScales TimeScale = TimeScales.Scaled
 the timescale to use (scaled or unscaled)
static Vector2 Clamps = new Vector2(-1f, 1f)
 the min/max clamp values applied to all acceleration and gravity vectors
static float LerpSpeed = 1f
 the speed at which lerped values move towards their targets
static bool TestMode
 whether or not to use test values instead of real sensor data

Protected Member Functions

virtual void OnEnable ()
virtual void OnDisable ()
virtual void Start ()
virtual void Update ()
virtual void HandleTestMode ()

Static Protected Member Functions

static Quaternion GyroscopeToUnity (Quaternion q)

Static Protected Attributes

static Vector3 _testVector = Vector3.zero

Properties

static Quaternion GyroscopeAttitude [get]
 the current device orientation as a quaternion (from AttitudeSensor / Input.gyro.attitude)
static Vector3 GyroscopeRotationRate [get]
 the current unbiased rotation rate in radians per second around each axis (from Gyroscope / Input.gyro.rotationRateUnbiased)
static Vector3 GyroscopeAcceleration [get]
 the current user-induced acceleration (gravity removed) in g-force units (from LinearAccelerationSensor / Input.gyro.userAcceleration)
static Vector3 InputAcceleration [get]
 the current raw accelerometer reading including gravity, clamped to the Clamps range (from Accelerometer / Input.acceleration)
static Vector3 GyroscopeGravity [get]
 the current gravity vector as reported by the sensor, clamped to the Clamps range (from GravitySensor / Input.gyro.gravity)
static Quaternion InitialGyroscopeAttitude [get]
 the device orientation captured at auto-calibration time (~0.5 s after start)
static Vector3 InitialGyroscopeRotationRate [get]
 the rotation rate captured at auto-calibration time
static Vector3 InitialGyroscopeAcceleration [get]
 the user acceleration captured at auto-calibration time
static Vector3 InitialInputAcceleration [get]
 the raw accelerometer reading captured at auto-calibration time
static Vector3 InitialGyroscopeGravity [get]
 the gravity vector captured at auto-calibration time
static Vector3 CalibratedInputAcceleration [get]
 the raw accelerometer reading rotated into the calibration reference frame
static Vector3 CalibratedGyroscopeGravity [get]
 the gravity vector rotated into the calibration reference frame
static Vector3 LerpedCalibratedInputAcceleration [get]
 CalibratedInputAcceleration smoothed over time using LerpSpeed.
static Vector3 LerpedCalibratedGyroscopeGravity [get]
 CalibratedGyroscopeGravity smoothed over time using LerpSpeed.

Detailed Description

A base gyroscope class, meant to be accessed statically or extended, that exposes a number of gyroscope values. CAREFUL: this will work fine on an iOS or Android build or any other device with a gyroscope, in build. Unity Remote won't send most of these gyro values (as of early May 2026, there's still hope it'll be fixed someday). You can look at the MMGyroParallax class for an example of implementation.

Member Enumeration Documentation

◆ TimeScales

Enumerator
Scaled 
Unscaled 

Member Function Documentation

◆ CalibrateDebug()

virtual void MoreMountains.Tools.MMGyroscope.CalibrateDebug ( )
virtual

◆ GetValues()

void MoreMountains.Tools.MMGyroscope.GetValues ( )
static

◆ GyroscopeDebugInitialization()

virtual void MoreMountains.Tools.MMGyroscope.GyroscopeDebugInitialization ( )
virtual

◆ GyroscopeInitialization()

void MoreMountains.Tools.MMGyroscope.GyroscopeInitialization ( )
static

◆ GyroscopeToUnity()

Quaternion MoreMountains.Tools.MMGyroscope.GyroscopeToUnity ( Quaternion q)
staticprotected

◆ HandleTestMode()

virtual void MoreMountains.Tools.MMGyroscope.HandleTestMode ( )
protectedvirtual

◆ OnDisable()

virtual void MoreMountains.Tools.MMGyroscope.OnDisable ( )
protectedvirtual

◆ OnEnable()

virtual void MoreMountains.Tools.MMGyroscope.OnEnable ( )
protectedvirtual

◆ Start()

virtual void MoreMountains.Tools.MMGyroscope.Start ( )
protectedvirtual

◆ Update()

virtual void MoreMountains.Tools.MMGyroscope.Update ( )
protectedvirtual

Member Data Documentation

◆ _TestMode

bool MoreMountains.Tools.MMGyroscope._TestMode = false

turn this on if you want to use the inspector to test this camera

◆ _testVector

Vector3 MoreMountains.Tools.MMGyroscope._testVector = Vector3.zero
staticprotected

◆ CalibrateButton

bool MoreMountains.Tools.MMGyroscope.CalibrateButton

◆ Clamps

Vector2 MoreMountains.Tools.MMGyroscope.Clamps = new Vector2(-1f, 1f)
static

the min/max clamp values applied to all acceleration and gravity vectors

◆ GyroscopeActive

bool MoreMountains.Tools.MMGyroscope.GyroscopeActive = true
static

whether or not the gyroscope is active

◆ GyroscopeInitializationBtn

bool MoreMountains.Tools.MMGyroscope.GyroscopeInitializationBtn

◆ LerpSpeed

float MoreMountains.Tools.MMGyroscope.LerpSpeed = 1f
static

the speed at which lerped values move towards their targets

◆ TestMode

bool MoreMountains.Tools.MMGyroscope.TestMode
static

whether or not to use test values instead of real sensor data

◆ TestXAcceleration

float MoreMountains.Tools.MMGyroscope.TestXAcceleration = 0f

the rotation to apply on the x axiswhen in test mode

◆ TestYAcceleration

float MoreMountains.Tools.MMGyroscope.TestYAcceleration = 0f

the rotation to apply on the y axis while in test mode

◆ TestZAcceleration

float MoreMountains.Tools.MMGyroscope.TestZAcceleration = 0f

the rotation to apply on the y axis while in test mode

◆ TimeScale

TimeScales MoreMountains.Tools.MMGyroscope.TimeScale = TimeScales.Scaled
static

the timescale to use (scaled or unscaled)

Property Documentation

◆ CalibratedGyroscopeGravity

Vector3 MoreMountains.Tools.MMGyroscope.CalibratedGyroscopeGravity
staticget

the gravity vector rotated into the calibration reference frame

◆ CalibratedInputAcceleration

Vector3 MoreMountains.Tools.MMGyroscope.CalibratedInputAcceleration
staticget

the raw accelerometer reading rotated into the calibration reference frame

◆ GyroscopeAcceleration

Vector3 MoreMountains.Tools.MMGyroscope.GyroscopeAcceleration
staticget

the current user-induced acceleration (gravity removed) in g-force units (from LinearAccelerationSensor / Input.gyro.userAcceleration)

◆ GyroscopeAttitude

Quaternion MoreMountains.Tools.MMGyroscope.GyroscopeAttitude
staticget

the current device orientation as a quaternion (from AttitudeSensor / Input.gyro.attitude)

◆ GyroscopeGravity

Vector3 MoreMountains.Tools.MMGyroscope.GyroscopeGravity
staticget

the current gravity vector as reported by the sensor, clamped to the Clamps range (from GravitySensor / Input.gyro.gravity)

◆ GyroscopeRotationRate

Vector3 MoreMountains.Tools.MMGyroscope.GyroscopeRotationRate
staticget

the current unbiased rotation rate in radians per second around each axis (from Gyroscope / Input.gyro.rotationRateUnbiased)

◆ InitialGyroscopeAcceleration

Vector3 MoreMountains.Tools.MMGyroscope.InitialGyroscopeAcceleration
staticget

the user acceleration captured at auto-calibration time

◆ InitialGyroscopeAttitude

Quaternion MoreMountains.Tools.MMGyroscope.InitialGyroscopeAttitude
staticget

the device orientation captured at auto-calibration time (~0.5 s after start)

◆ InitialGyroscopeGravity

Vector3 MoreMountains.Tools.MMGyroscope.InitialGyroscopeGravity
staticget

the gravity vector captured at auto-calibration time

◆ InitialGyroscopeRotationRate

Vector3 MoreMountains.Tools.MMGyroscope.InitialGyroscopeRotationRate
staticget

the rotation rate captured at auto-calibration time

◆ InitialInputAcceleration

Vector3 MoreMountains.Tools.MMGyroscope.InitialInputAcceleration
staticget

the raw accelerometer reading captured at auto-calibration time

◆ InputAcceleration

Vector3 MoreMountains.Tools.MMGyroscope.InputAcceleration
staticget

the current raw accelerometer reading including gravity, clamped to the Clamps range (from Accelerometer / Input.acceleration)

◆ LerpedCalibratedGyroscopeGravity

Vector3 MoreMountains.Tools.MMGyroscope.LerpedCalibratedGyroscopeGravity
staticget

CalibratedGyroscopeGravity smoothed over time using LerpSpeed.

◆ LerpedCalibratedInputAcceleration

Vector3 MoreMountains.Tools.MMGyroscope.LerpedCalibratedInputAcceleration
staticget

CalibratedInputAcceleration smoothed over time using LerpSpeed.


The documentation for this class was generated from the following file:
  • H:/Code/MoreMountains/topdownengine/Assets/TopDownEngine/ThirdParty/MoreMountains/MMTools/Accessories/MMGyroscope/MMGyroscope.cs