-
Notifications
You must be signed in to change notification settings - Fork 0
Vector3Int Extensions
Deconstructs a Vector3Int instance into its individual components.
Vector3Int vector = // initialize your Vector3Int
int x, y, z;
vector.Deconstruct(out x, out y, out z);Parameters:
-
vector: The Vector3Int instance.
Outputs:
-
x: The x component of the Vector3Int. -
y: The y component of the Vector3Int. -
z: The z component of the Vector3Int.
Creates a new Vector3Int instance with the specified components, or the original components if not specified.
Vector3Int originalVector = // initialize your Vector3Int
int? x = // optional
int? y = // optional
int? z = // optional
Vector3Int newVector = originalVector.With(x, y, z);Parameters:
-
originalVector: The original Vector3Int instance. -
x: The x component of the new Vector3Int. If null, the x component of the original Vector3Int is used. -
y: The y component of the new Vector3Int. If null, the y component of the original Vector3Int is used. -
z: The z component of the new Vector3Int. If null, the z component of the original Vector3Int is used.
Returns:
-
newVector: A new Vector3Int instance with the specified components.
Calculates the distance from a Vector3Int to a point.
Vector3Int vector = // initialize your Vector3Int
Vector3Int point = // initialize the point
float distance = vector.Distance2Point(point);Parameters:
-
vector: The Vector3Int instance. -
point: The point to calculate the distance to.
Returns:
-
distance: The distance from the Vector3Int to the point.
Calculates the shortest distance from a Vector3 to a line segment.
Vector3Int vector = // initialize your Vector3Int
Vector3Int linePoint1 = // initialize the first point of the line segment
Vector3Int linePoint2 = // initialize the second point of the line segment
float distance = vector.Distance2Line(linePoint1, linePoint2);Parameters:
-
vector: The Vector3Int instance. -
linePoint1: The first point of the line segment. -
linePoint2: The second point of the line segment.
Returns:
-
distance: The shortest distance from the Vector3Int to the line segment.
Clamps the components of a Vector3Int between specified minimum and maximum values.
Vector3Int vector = // initialize your Vector3Int
int min = // initialize the minimum value
int max = // initialize the maximum value
Vector3Int clampedVector = vector.Clamp(min, max);Parameters:
-
vector: The Vector3Int instance. -
min: The minimum value to clamp the components to. -
max: The maximum value to clamp the components to.
Returns:
-
clampedVector: The clamped Vector3Int.
Vector3Int vector = // initialize your Vector3Int
Vector3Int min = // initialize the minimum vector
Vector3Int max = // initialize the maximum vector
Vector3Int clampedVector = vector.Clamp(min, max);Parameters:
-
vector: The Vector3Int instance. -
min: The minimum vector to clamp the components to. -
max: The maximum vector to clamp the components to.
Returns:
-
clampedVector: The clamped Vector3Int.
Flips a Vector3Int in all directions.
Vector3Int vector = // initialize your Vector3Int
Vector3Int flippedVector = vector.Flip();Parameters:
-
vector: The Vector3Int instance.
Returns:
-
flippedVector: The flipped Vector3Int.
Flips a Vector3Int in the x direction.
Vector3Int vector = // initialize your Vector3Int
Vector3Int flippedVector = vector.FlipX();Parameters:
-
vector: The Vector3Int instance.
Returns:
-
flippedVector: The flipped Vector3Int.
Flips a Vector3Int in the y direction.
Vector3Int vector = // initialize your Vector3Int
Vector3Int flippedVector = vector.FlipY();Parameters:
-
vector: The Vector3Int instance.
Returns:
-
flippedVector: The flipped Vector3Int.
Flips a Vector3Int in the z direction.
Vector3Int vector = // initialize your Vector3Int
Vector3Int flippedVector = vector.FlipZ();Parameters:
-
vector: The Vector3Int instance.
Returns:
-
flippedVector: The flipped Vector3Int.
Returns a Vector2Int with the x and y components of a Vector3Int.
Vector3Int vector = // initialize your Vector3Int
Vector2Int xyVector = vector.GetXy();Parameters:
-
vector: The Vector3Int instance.
Returns:
-
xyVector: A Vector2Int with the x and y components of the Vector3Int.
Returns a Vector2Int with the y and z components of a Vector3Int.
Vector3Int vector = // initialize your Vector3Int
Vector2Int yzVector = vector.GetYz();Parameters:
-
vector: The Vector3Int instance.
Returns:
-
yzVector: A Vector2Int with the y and z components of the Vector3Int.
Returns a Vector2Int with the x and z components of a Vector3Int.
Vector3Int vector = // initialize your Vector3Int
Vector2Int xzVector = vector.GetXz();Parameters:
-
vector: The Vector3Int instance.
Returns:
-
xzVector: A Vector2Int with the x and z components of the Vector3Int.