CoronaSDK 2013.1126 | Released: 24 May 2013, 1:59am | What's New | Download Now
These docs are *very* out of date.
You will be redirected to the new docs in a few seconds.
If you are certain you want to see the old docs, click cancel.
Cancel | Continue to new docs
You will be redirected to the new docs in a few seconds.
If you are certain you want to see the old docs, click cancel.
Cancel | Continue to new docs
event.xRotation
Description:
Gets the rotation rate around the device's x-axis in radians per second.
Syntax:
value = event.xRotation
Example:
-- Called when a new gyroscope measurement has been received. local function onGyroscopeDataReceived( event ) -- Calculate approximate rotation traveled via deltaTime. -- Remember that rotation rate is in radians per second. local deltaRadians = event.xRotation * event.deltaTime local deltaDegrees = deltaRadians * (180 / math.pi) end -- Set up the above function to receive gyroscope events if the sensor exists. if system.hasEventSource( "gyroscope" ) then Runtime:addEventListener( "gyroscope", onGyroscopeDataReceived ) end
Parameters:
None
Returns:
number
Returns the rotation rate in radians per second where values are positive in the counter-clockwise direction.
Remarks:
You can convert radians to degrees via the following formula:
degrees = radians * (180 / pi)
Supported on operating systems and platforms for build numbers shown:
- Mac OS X:--
- Windows:--
- iOS:2011.544
- Android:2011.544