iPhone Accelerometer Joystick question
by Scott Wilson-Billing · in iTorque 2D · 01/19/2010 (8:24 pm) · 2 replies
Hopefully a simple one. although I'm struggling with it :)
joystickX - is this accelerometer tilt left/right?
joystickY - is this accelerometer tilt forward/backwards?
joystickZ - is this accelerometer ?
what are the possible ranger of values for X/Y/Z e.g. if I hold iphone flat? if I stand iphone on it's edge forming a 90 degree angle?
I've got left/right working but want tilt forward to fire, tilt backwards to toggle auto fire. e.g. title forward is fire a single bullet, tilt backwards switches on auto fire. Tilt forward now fires a stream of bullets, tilt backwards switch off auto fire, tilt forwards now just fires a single bullet.
Cheers
joystickX - is this accelerometer tilt left/right?
joystickY - is this accelerometer tilt forward/backwards?
joystickZ - is this accelerometer ?
what are the possible ranger of values for X/Y/Z e.g. if I hold iphone flat? if I stand iphone on it's edge forming a 90 degree angle?
I've got left/right working but want tilt forward to fire, tilt backwards to toggle auto fire. e.g. title forward is fire a single bullet, tilt backwards switches on auto fire. Tilt forward now fires a stream of bullets, tilt backwards switch off auto fire, tilt forwards now just fires a single bullet.
Cheers
#2
but basically it depends on what you call left and right. If you hold the phone in landscape with the button on your right, then yes you are basically right. It's really easy to observe for yourself and see what values you get.
01/20/2010 (6:24 am)
Why don't you do what I did, make a simple game with 3 text objects and feed the x,y,z values into the objects, then you can see how they work. I believe experimentation goes way further than any simple explanation.but basically it depends on what you call left and right. If you hold the phone in landscape with the button on your right, then yes you are basically right. It's really easy to observe for yourself and see what values you get.
Torque 3D Owner Marc Dreamora Schaerer
Gayasoft
the accelerometer does not give you any tilts.
The accelerometer gives you a 3D vector that tells you the "down direction" in X,Y,Z axis respectively
Tilt etc has to be calculated by you basing on that on a "null orientation direction"