Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- static public class Vector3Ext {
- /// <summary>
- /// Gives absolute distance instead of returning a negative value.
- /// </summary>
- /// <returns>The all.</returns>
- /// <param name="pos1">Pos1.</param>
- /// <param name="pos2">Pos2.</param>
- static public Vector3 DistanceAll (Vector3 pos1, Vector3 pos2) {
- Vector3 dist = pos1 - pos2;
- dist.x = Mathf.Abs(dist.x);
- dist.y = Mathf.Abs(dist.y);
- dist.z = Mathf.Abs(dist.z);
- return dist;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement