UnityQuaternionExtension.cs 662 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using LeapInternal;
  3. using UnityEngine;
  4. namespace Leap.Unity
  5. {
  6. public static class UnityQuaternionExtension
  7. {
  8. public static Quaternion ToQuaternion(this LeapQuaternion q)
  9. {
  10. return new Quaternion(q.x, q.y, q.z, q.w);
  11. }
  12. public static Quaternion ToQuaternion(this LEAP_QUATERNION q)
  13. {
  14. return new Quaternion(q.x, q.y, q.z, q.w);
  15. }
  16. public static LeapQuaternion ToLeapQuaternion(this Quaternion q)
  17. {
  18. return new LeapQuaternion(q.x, q.y, q.z, q.w);
  19. }
  20. public static LEAP_QUATERNION ToCQuaternion(this Quaternion q)
  21. {
  22. return new LEAP_QUATERNION
  23. {
  24. x = q.x,
  25. y = q.y,
  26. z = q.z,
  27. w = q.w
  28. };
  29. }
  30. }
  31. }