Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Modify and return a Vector with one new component
  • Loading branch information
mstevenson committed Apr 8, 2012
1 parent 0328723 commit 694ddf0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Vector3Extensions.cs
Expand Up @@ -11,4 +11,19 @@ public static float LargestComponent (this Vector3 v)
return v.x > v.y ? (v.x > v.z ? v.x : (v.y > v.z ? v.y : v.z)) : (v.y > v.z ? v.y : (v.x > v.z ? v.x : v.z));
}

public static Vector3 WithX (this Vector3 vec, float value)
{
return new Vector3 (value, vec.y, vec.z);
}

public static Vector3 WithY (this Vector3 vec, float value)
{
return new Vector3 (vec.x, value, vec.z);
}

public static Vector3 WithZ (this Vector3 vec, float value)
{
return new Vector3 (vec.x, vec.y, value);
}

}

0 comments on commit 694ddf0

Please sign in to comment.