UnityVectorExtension.cs 758 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using LeapInternal;
  3. using UnityEngine;
  4. namespace Leap.Unity
  5. {
  6. public static class UnityVectorExtension
  7. {
  8. public static Vector3 ToVector3(this Vector vector)
  9. {
  10. return new Vector3(vector.x, vector.y, vector.z);
  11. }
  12. public static Vector3 ToVector3(this LEAP_VECTOR vector)
  13. {
  14. return new Vector3(vector.x, vector.y, vector.z);
  15. }
  16. public static Vector4 ToVector4(this Vector vector)
  17. {
  18. return new Vector4(vector.x, vector.y, vector.z, 0f);
  19. }
  20. public static Vector ToVector(this Vector3 vector)
  21. {
  22. return new Vector(vector.x, vector.y, vector.z);
  23. }
  24. public static LEAP_VECTOR ToCVector(this Vector3 vector)
  25. {
  26. return new LEAP_VECTOR
  27. {
  28. x = vector.x,
  29. y = vector.y,
  30. z = vector.z
  31. };
  32. }
  33. }
  34. }