public void ResetHome() { var incl = OrientationSensor.GetDefault(); OrientationSensorReading inc = incl.GetCurrentReading(); if (inc != null) { zeroSet = true; zeroMatrix = inc.RotationMatrix; } }
/// <summary> /// Creates a new instance of this class. /// </summary> /// <param name="report">The sensor report to evaluate.</param> internal OrientationSensorReading(SensorReport report) { if (report == null) { throw new ArgumentNullException("report"); } byte[] q = report.Values[SensorDataKey][0] as byte[]; byte[] m = report.Values[SensorDataKey][1] as byte[]; if (q != null && q.Length == 16) { Quaternion = new SensorQuaternion(q); } if (m != null && m.Length == 36) { RotationMatrix = new SensorRotationMatrix(m); } }
protected override void Update(GameTime gameTime) { if (!zeroSet) { ResetHome(); } else { var incl = OrientationSensor.GetDefault(); var inc = incl.GetCurrentReading(); if (inc != null) { cameraMatrix = inc.RotationMatrix; } } // shapes.Last().Position = shapes.First().Position + new Vector3(0.01f, 0.1f, 0); shapes.Last().Rotation = shapes.Last().Rotation + new Vector3(0,0, 0.01f); base.Update(gameTime); }