FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Accelerometers rotation

2 posters

Go down

Accelerometers rotation Empty Accelerometers rotation

Post  kotobuki Thu Nov 13, 2008 9:40 am

Hello.
I'm starting to use SIO2 for a small project I have. I'm really new to this engine and to iPhone SDK also, but I could load my model with textures ect quite well an the device also. I really have to thank all of you who wrote this engine! Thanks to it, so much is possible without coding pure OpenGl ES...

I would like to apply a rotation to my model with the accelerometers, to make it always have his head toward the top. The Sample Code GLGravity is demonstrating it with a teapot. I had a look to the tutorial 4 which makes usage of accels but not for rotation.

Cool you gave me a hint of how i should do that ? Maybe I can use some part of the SampleCode with the teapot (which is written in OpenGL) ? If yes, it would greatly help me if I could have some code hint and explanation.

Thanks a lot!!

Dom

kotobuki

Posts : 1
Join date : 2008-11-13

Back to top Go down

Accelerometers rotation Empty Re: Accelerometers rotation

Post  matt Thu Nov 13, 2008 1:00 pm

The accelerometer values are between -1.0 and 1.0 for each axis, where +/-1.0 would mean that you rotate the device 90 degrees around this axis. In order to apply rotation to your model, you could scale such values by a certain amount to avoid that one has to rotate it 90 degrees for the full effect and simply add the current value to the models rotation. So, if one keeps holding the device e.g. -45 degrees on the x-axis, the accelerometer value would be -0.5, scaled by e.g. 10, and your model would rotate 5 degrees per frame.

Best,
Matt

matt

Posts : 155
Join date : 2008-09-30

http://elfrun.net

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum