Hi, as the title implies, I’m trying to use the accelerometer to control an applyForce function so that I can move an object left and right. I’m obviously doing something wrong here, because I’m not getting any movement from using the accelerometer. Is there a preferred method for something like this? Thanks in advance.
[code]
local acc = {}
motiony = 0
motionx = 100
function acc:accelerometer(event)
motionx = motionx * event.xGravity
end
Runtime:addEventListener(“accelerometer”, acc)
function forceApplyer ( event )
print( "Value = " … tonumber( motionx ) )
ball:applyForce( motionx, motiony, ball.x, ball.y )
end
Runtime:addEventListener (“enterFrame”, forceApplyer) [import]uid: 66329 topic_id: 23435 reply_id: 323435[/import]
[import]uid: 52491 topic_id: 23435 reply_id: 94035[/import]