Documentation for the Unity C# Library
Loading...
Searching...
No Matches
Vector3Extensions.cs
Go to the documentation of this file.
1using UnityEngine;
2
4{
5 public static class Vector3Extensions
6 {
7 public static Vector3 SetCoordinates(this Vector3 vector, float? x = null, float? y = null, float? z = null)
8 {
9 return new Vector3(x ?? vector.x, y ?? vector.y, z ?? vector.z);
10 }
11
12 public static Vector3 ChangeByValues(this Vector3 vector, float x = 0, float y = 0, float z = 0)
13 {
14 return new Vector3(vector.x + x, vector.y + y, vector.z + z);
15 }
16
17 public static Vector3 ProjectionToXZPlane(this Vector3 vector)
18 {
19 return vector.SetCoordinates(y: 0);
20 }
21 }
22}
static Vector3 SetCoordinates(this Vector3 vector, float? x=null, float? y=null, float? z=null)
static Vector3 ChangeByValues(this Vector3 vector, float x=0, float y=0, float z=0)
static Vector3 ProjectionToXZPlane(this Vector3 vector)