Accelerometers rotation
2 posters
Accelerometers rotation
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
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
Re: Accelerometers rotation
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
Best,
Matt
Similar topics
» Bug Report - Camera IPO with no rotation
» Widget rotation?
» calculate an angle rotation from a direction vector
» Rotation of rolling object is zero.
» Collision objects without rotation
» Widget rotation?
» calculate an angle rotation from a direction vector
» Rotation of rolling object is zero.
» Collision objects without rotation
Permissions in this forum:
You cannot reply to topics in this forum