> Basically the accelerometer is able to measure gravity acceleration > projected on its 3 axes (see http://www.starlino.com/imu_guide.html > for a more detailed description).. so in my python code I get these > values. Now, using some math (atan2 and other stuff) I should be able > to calculate rotations around x, y, z. Once I get these angles using > eg. rotate_x I should be able to rotate the cuboid to the same > position of the accelerometer. > > However, I'm stuck on how to rotate my cuboid according to the angles > calculated from the accelerometer. If I use the code posted above the > animation become really slow and sloppy till almost not working.
I think that the problem is "what are x, y and z axis ?". When you calculate rotations around x, y, z, is it x, y and z of the rotated object ? or x, y and z of its "parent" (e.g. the room ?) ? In soya, rotate_x() is relative to the parent's coordinate system, and turn_x is relative to the object own coord syst. Other rotation could be performed using more complex rotations functions. Jiba _______________________________________________ Soya-user mailing list Soya-user@gna.org https://mail.gna.org/listinfo/soya-user