iPhone Accelerometer

Hey everyone!

I am new here and to Unity, but not to the iPhone. I have 4 games on the App Store as of now

Right now, I have the Unity iPhone Indie Demo and I am making a sample project with the general idea of Super Monkey Ball. Right now, I am using buttons for going left and right (does anyone know how to make transparent Javascript buttons?), but I would like to use the accelerometer.

Could someone please fill me in on how to use the iPhone accelerometer in Unity (preferably in Javascript)

Thank you!

Robert
CEO, App Tech Studios

Hello,

I’m new too Unity iPhone as well. But i got a kick start about buttons with the Penelope tutorial. A lot of Accelerometer questions are answered with the Star Troopers demo. Just look inside the tutorial section for iPhone on the unity website .

Peter. :smile:

iPhoneInput.acceleration.x, iPhoneInput.acceleration.y, and iPhoneInput.acceleration.z give you the values of the accelerometer.

You can check for them in the Update() function of the script for your camera.

Thank you so much! Here is my final line:

transform.position.x+=iPhoneInput.acceleration.x *.8;

Obviously, the number adjusts the sensitivity. I hope this helps anyone else with the same problem :slight_smile:

AppTechStudios, oh but we’ve documented this in the Manual and have some sample projects and tutorials available to give everyone interested a quick start =)

I seem to never find the tutorial that I need. Oh well.

Thanks guys/gals!