Advertisement
Guest User

Untitled

a guest
Oct 6th, 2015
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. static public class Vector3Ext {
  5. /// <summary>
  6. /// Gives absolute distance instead of returning a negative value.
  7. /// </summary>
  8. /// <returns>The all.</returns>
  9. /// <param name="pos1">Pos1.</param>
  10. /// <param name="pos2">Pos2.</param>
  11. static public Vector3 DistanceAll (Vector3 pos1, Vector3 pos2) {
  12. Vector3 dist = pos1 - pos2;
  13.  
  14. dist.x = Mathf.Abs(dist.x);
  15. dist.y = Mathf.Abs(dist.y);
  16. dist.z = Mathf.Abs(dist.z);
  17.  
  18. return dist;
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement