36 x = v.x; y = v.y; z = v.z;
40 this.x = x; this.y = y; this.z = z;
48 public bool isValid {
get {
return new Vector3(x, y, z) != Vector3.zero; } }
51 public Vector3
Vec() {
55 public static implicit
operator Vector3(
Direction3 dir) {
56 var normalized =
new Vector3(dir.x, dir.y, dir.z).normalized;
57 if (normalized == Vector3.zero) {
58 return Vector3.forward;
63 public static implicit
operator Direction3(Vector3 vec) {
76 Vector3 aV =
new Vector3(
A.x,
A.y,
A.z);
77 Vector3 bV =
new Vector3(
B.x,
B.y,
B.z);
78 return Vector3.Cross(aV, bV).sqrMagnitude == 0f;
A struct very similar to Vector3, but that prevents itself from ever being converted to Vector3....
bool isValid
Gets whether this Direction3 will normalize without issue (has nonzero magnitude),...
static bool PointsInSameDirection(Direction3 A, Direction3 B)
Returns whether two Direction3s point in the same direction without normalizing either of the underly...
Direction3(float x, float y, float z)
Vector3 Vec()
Explicitly converts this Direction3 to a Vector3.