[MonoTouch] openGL Y axis rotation
Gargamelle
Dycamedia at dycamedia.com
Sun Mar 4 07:46:11 UTC 2012
Hello,
I can't understand why the Y rotation stays to 0 in the following example.
I use the device as a camera. I trace in the Label the 3 values I get from
rotation.
X and Z work fine, Y is 0.
If anybody have an idea of my mistake...
Thank you in advance
Denys
Initialisation
...
//View
matWorld = Matrix4.Identity; // permet d'initialiser la matrice avec une
valeur connue
aspectRatio = (float)(Size.Width) / (float)(Size.Height);
matProjection = Matrix4.CreatePerspectiveFieldOfView (((float)(Math.PI) /
180.0f) * 45.0f,
aspectRatio, 1.0f,
20.0f);
matView = Matrix4.CreateTranslation (0f, 0f, 8f);
matWorldViewProjection = matWorld * matView * matProjection;
...
Start animating
...
motionManager.StartGyroUpdates (NSOperationQueue.MainQueue,
GyroData_Received);
...
Observing motion
private void GyroData_Received (CMGyroData gyroData, NSError error)
{
if(currentDeviceMotion != null)
{
gyroRotX = -(float)currentDeviceMotion.Attitude.Pitch;
gyroRotY = -(float)currentDeviceMotion.Attitude.Yaw;
gyroRotZ = -(float)currentDeviceMotion.Attitude.Roll;
la_debug.Text = string.Format
("gyro X: {0:00000} \nY: {1:00000} \nZ: {2:00000}",
gyroRotX, gyroRotY, gyroRotZ);
}
}
--
View this message in context: http://monotouch.2284126.n4.nabble.com/openGL-Y-axis-rotation-tp4443100p4443100.html
Sent from the MonoTouch mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monotouch/attachments/20120303/a0b07c5e/attachment.html>
More information about the MonoTouch
mailing list