objects and physics

I am looking for a way to allow the user to control an object with the accelerometer that is able to be calibrated so that the user doesn't have to tilt the device completely away from themselves to move the object along the y axis.

I have tried setting the gravity to various degrees of negative values, but this doesn't work correctly (I.E., the object 'floats' to the top of the screen and gets stuck there, or something in between that and just leaving the values at 0)

Any help would be greatly appreciated.

You would probably need to figure out the the "zero point" for the devices orientation that you want to start from and then make your calculations from there. You could probably use the accelerometer sample code here http://developer.anscamobile.com/content/accelerometer-1
Just hold the device in the position you would like the player to start from and write down the accelerometer data that is shown on the screen and use that as your starting point for gravity to be set to 0, then apply positive or negative gravity depending on the direction of the tilt from there.

views:1476 update:2011/11/19 17:31:56
corona forums © 2003-2011