Note that there are some explanatory texts on larger screens.

plurals
  1. PORecent gyroscope support from Corona SDK seems to be non-responsive
    primarykey
    data
    text
    <p>I'm using a recent daily build of the <strong>Corona SDK</strong> (version 2001.562) to add gyroscope support to an existing application. Unfortunately, I can't seem to get the <code>event-handling</code> function for the gyroscope to fire. The application is running on an <strong>iPod touch, version 4.3.3</strong>.</p> <p>I attach the gyroscope to an event handler like so:</p> <pre><code>if system.hasEventSource("gyroscope") then feedbackFile = io.open(system.pathForFile("log.txt", system.DocumentsDirectory), "a"); feedbackFile:write((os.clock()-startupTime).."\tgyroscope on\n"); io.close(feedbackFile); Runtime:addEventListener( "gyroscope", onGyroscopeDataReceived ) else feedbackFile = io.open(system.pathForFile("log.txt", system.DocumentsDirectory), "a"); feedbackFile:write((os.clock()-startupTime).."\tgyroscope off\n"); io.close(feedbackFile); end </code></pre> <p>When I launch the application on the device, then close it and download the resource files, I find that <code>log.txt</code> contains the line with a <code>timestamp</code> and "gyroscope on". Good so far!</p> <p>On to the event-handling function:</p> <pre><code>local function onGyroscopeDataReceived(event) feedbackFile = io.open(system.pathForFile("log.txt", system.DocumentsDirectory), "a"); feedbackFile:write((os.clock()-startupTime).."\tgyroscope reading delta="..event.deltaRotation..",x="..event.xRotation..",y="..event.yRotation..",z="..event.zRotation.."\n"); io.close(feedbackFile); end </code></pre> <p>This line of information never appears in the <code>log.txt</code> file!</p> <p>Please advise. Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload