Sensor - stingray.Sensor namespace reference - Stingray Lua API Reference

Description

Interface to communicate with devices sensors.

Accelerometer

Parameters
This function does not accept any parameters.
Returns

stingray.Vector3

Returns the accelerometers acceleration.

Acceleration multiplied by acceleration resolution is G (9.81 m s^-2) in 3-axis.

Parameters
This function does not accept any parameters.
Returns

boolean

Returns true if the devices has a available accelerometer, or false otherwise.

Parameters
This function does not accept any parameters.
Returns

number

Returns the accelerometer update frequency in hz.

Parameters
This function does not accept any parameters.
Returns

stingray.Vector3

Returns the acceleration resolution.

Acceleration multiplied by accelerometer_acceleration_resolution is G (9.81 m s^-2) in 3-axis.

Parameters

frequency :

number

Update frequency for accelerometer in hz.

Returns
This function does not return any values.

Gravity Sensor

Parameters
This function does not accept any parameters.
Returns

boolean

Returns true if the devices has a available gravity sensor, or false otherwise.

Parameters
This function does not accept any parameters.
Returns

number

Returns the gravity sensor update frequency in hz.

Parameters
This function does not accept any parameters.
Returns

stingray.Vector3

Returns the gravity sensor gravity.

Gravity multiplied by acceleration resolution is G (9.81 m s^-2) in 3-axis.

Parameters
This function does not accept any parameters.
Returns

stingray.Vector3

Returns the gravity resolution.

Gravity multiplied by acceleration resolution is G (9.81 m s^-2) in 3-axis.

Parameters

frequency :

number

Update frequency for gravity sensor in hz.

Returns
This function does not return any values.

Gyroscope

Parameters
This function does not accept any parameters.
Returns

boolean

Returns true if the devices has a available gyroscope, or false otherwise.

Parameters
This function does not accept any parameters.
Returns

number

Returns the gyroscope update frequency in hz.

Parameters
This function does not accept any parameters.
Returns

stingray.Vector3

Returns the gyroscopes rotation rate.

Parameters

frequency :

number

Update frequency for gyroscope in hz.

Returns
This function does not return any values.

Magnetometer

Parameters
This function does not accept any parameters.
Returns

boolean

Returns true if the devices has a available magnetometer, or false otherwise.

Parameters
This function does not accept any parameters.
Returns

stingray.Vector3

Returns the calibrated magnetometer magnetic field.

Calibrated magnetic field multiplied by magnetic field resolution is magnetic field in microteslas in 3-axis.

Parameters
This function does not accept any parameters.
Returns

boolean

Returns true if the devices can calibrate magnetometer, or false otherwise.

Parameters
This function does not accept any parameters.
Returns

number

Returns the magnetometer update frequency in hz.

Parameters
This function does not accept any parameters.
Returns

stingray.Vector3

Returns the magnetometer magnetic field.

Magnetic field multiplied by magnetic field resolution is magnetic field in microteslas in 3-axis.

Parameters
This function does not accept any parameters.
Returns

stingray.Vector3

Returns the magnetic field resolution.

Magnetic field multiplied by magnetic field resolution is magnetic field in microteslas in 3-axis.

Parameters

frequency :

number

Update frequency for magnetometer in hz.

Returns
This function does not return any values.

Orientation Sensor

Parameters
This function does not accept any parameters.
Returns

boolean

Returns true if the devices has a available orientation sensor, or false otherwise.

Parameters
This function does not accept any parameters.
Returns

number

Returns the orientation sensor update frequency in hz.

Parameters
This function does not accept any parameters.
Returns

stingray.Quaternion

Returns the orientation sensor rotation.

Parameters
This function does not accept any parameters.
Returns

string

Returns the current performance hint.

Parameters

frequency :

number

Update frequency for orientation sensor in hz.

Returns
This function does not return any values.
Parameters

hint :

string

Performance hint can be "fast" or "correct".

Returns
This function does not return any values.

Sensor output can be computed as fast as possible or as correct on some platform, seting this hint allows the implementation to prioritize correctness or speed.

Performance Hint