Bonjour à tous,
Je ne sais pas si ce forum s'y prête, mais n'obtenant pas de réponse, voici ma question:
Environnement: Monotouch 5.2.5
J'utilise l'Iphone comme une caméra et analyse son orientation en boucle.
Les coordonnées X et Z fonctionnent parfaitement, Y reste sensiblement à 0...
Ci-dessous des extraits significatifs de mon code.
Si qq'un a une idée!
Merci d'avance
Snipon
Initialisation
Start animating
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 ... //View matWorld = Matrix4.Identity; 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; ...
Observing motion
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 ... motionManager.StartGyroUpdates (NSOperationQueue.MainQueue, GyroData_Received); ...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 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); } }
Partager