Class VectorExtensions
Inherited Members
Namespace: BomberDogs.Extensions
Assembly: Assembly-CSharp.dll
Syntax
public static class VectorExtensions
Methods
| Edit this page View SourceChangeZ(Vector3, float)
Change only z value
Declaration
public static Vector3 ChangeZ(this Vector3 vector, float value)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | vector | |
| float | value |
Returns
| Type | Description |
|---|---|
| Vector3 |
ClampAxisTo8Directions(Vector2)
Limits a direction to only 8 directions.
Declaration
public static Vector2 ClampAxisTo8Directions(this Vector2 direction)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | direction | direction |
Returns
| Type | Description |
|---|---|
| Vector2 | clamped direction |
Snap(Vector2)
Centers to the middle of each 1-meter square in the scene space. For example, 0.01 becomes 0.5, 0.99 becomes 0.5, 1.01 becomes 1.5, and so on.
Declaration
public static Vector2 Snap(this Vector2 vector)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | vector | original vector |
Returns
| Type | Description |
|---|---|
| Vector2 | snapped position |
Snap(Vector3)
Centers to the middle of each 1-meter square in the scene space. For example, 0.01 becomes 0.5, 0.99 becomes 0.5, 1.01 becomes 1.5, and so on.
Declaration
public static Vector3 Snap(this Vector3 vector)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | vector | original vector |
Returns
| Type | Description |
|---|---|
| Vector3 | snapped position |
clampAxisTo4Directions(Vector2)
Limits a direction to only 4 directions.
Declaration
public static Vector2 clampAxisTo4Directions(this Vector2 direction)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | direction |
Returns
| Type | Description |
|---|---|
| Vector2 |