How to move a dynamic physics object via accelerometer.

I am trying to move a ball around using the accelerometer, but I am having a hard time doing so, its either really jerky or the ball wont move up or down.

Would it be easier if it wasn’t dynamic?

Here is my code.

-- The hero variable is a newCircle() local function heroMovex(event) hero.x = (hero.x + event.xGravity)+20 hero.y = (hero.y + event.yGravity)+20 end Runtime:addEventListener("accelerometer", heroMovex)

Hi Sebastian,

You might want to test out the sample project which does this. It’s located in your local Corona application folder here:

CoronaSDK > SampleCode > Physics > ShapeTumbler

Note that you’ll need to install it on a device, since the accelerometer isn’t supported in the Corona Simulator.

Take care,

Brent

Hi Sebastian,

You might want to test out the sample project which does this. It’s located in your local Corona application folder here:

CoronaSDK > SampleCode > Physics > ShapeTumbler

Note that you’ll need to install it on a device, since the accelerometer isn’t supported in the Corona Simulator.

Take care,

Brent