MCPcopy Create free account
hub / github.com/ValveSoftware/openvr / GetRotation

Method GetRotation

headers/openvr_api.cs:6389–6405  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6387 }
6388
6389 public Quaternion GetRotation()
6390 {
6391 if (IsRotationValid())
6392 {
6393 float w = Mathf.Sqrt(Mathf.Max(0, 1 + m0 + m5 + m10)) / 2;
6394 float x = Mathf.Sqrt(Mathf.Max(0, 1 + m0 - m5 - m10)) / 2;
6395 float y = Mathf.Sqrt(Mathf.Max(0, 1 - m0 + m5 - m10)) / 2;
6396 float z = Mathf.Sqrt(Mathf.Max(0, 1 - m0 - m5 + m10)) / 2;
6397
6398 _copysign(ref x, -m9 - -m6);
6399 _copysign(ref y, -m2 - -m8);
6400 _copysign(ref z, m4 - m1);
6401
6402 return new Quaternion(x, y, z, w);
6403 }
6404 return Quaternion.identity;
6405 }
6406
6407 private static void _copysign(ref float sizeval, float signval)
6408 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected