Class Vector2dExtensions
- Namespace
- FixedMathSharp
Provides conversions between Unity vectors and FixedMathSharp 2D vectors.
public static class Vector2dExtensions
- Inheritance
-
Vector2dExtensions
- Inherited Members
Methods
ToVector2(Vector2d)
Converts a FixedMathSharp Vector2d to a Unity Vector2.
public static Vector2 ToVector2(this Vector2d vec)
Parameters
vecVector2dThe FixedMathSharp Vector2d to convert.
Returns
- Vector2
A Unity Vector2.
Remarks
This is a direct component mapping for 2D values and does not perform any 3D axis conversion.
ToVector2d(Vector2)
Converts a Unity Vector2 to a FixedMathSharp Vector2d.
public static Vector2d ToVector2d(this Vector2 vec2)
Parameters
vec2Vector2The Unity Vector2 to convert.
Returns
- Vector2d
A FixedMathSharp Vector2d.
Remarks
This is a direct component mapping for Unity 2D values. In FixedMathSharp 2D plane math,
+X is right and +Y is forward/up within the 2D plane.
ToVector2dXY(Vector3)
Converts a Unity Vector3 to a FixedMathSharp Vector2d using the x and y components.
public static Vector2d ToVector2dXY(this Vector3 vec)
Parameters
vecVector3The Unity Vector3 to convert.
Returns
- Vector2d
A FixedMathSharp Vector2d projected onto the XY plane.
Remarks
This is a direct component projection onto the Unity XY plane. Use
ToVector2dXZ(Vector3) when the 2D vector represents Unity ground-plane
movement where +Z is forward.
ToVector2dXZ(Vector3)
Converts a Unity Vector3 to a FixedMathSharp Vector2d using the x and z components.
public static Vector2d ToVector2dXZ(this Vector3 vec)
Parameters
vecVector3The Unity Vector3 to convert.
Returns
- Vector2d
A FixedMathSharp Vector2d projected onto the XZ plane.
Remarks
Unity and FixedMathSharp both use +X right and +Z forward in 3D. This helper
keeps that convention explicit when reducing Unity XZ-plane directions or positions to
FixedMathSharp 2D plane math.
ToVector3XY(Vector2d, float)
Converts a FixedMathSharp Vector2d to a Unity Vector3 on the XY plane, with the specified z-value.
public static Vector3 ToVector3XY(this Vector2d vec, float z = 0)
Parameters
vecVector2dThe FixedMathSharp Vector2d to convert.
zfloatThe z-value to use in the resulting Vector3.
Returns
- Vector3
A Unity Vector3 with x/y populated from the Vector2d.
Remarks
This is a direct component projection onto Unity's XY plane. Use
ToVector3XZ(Vector2d, float) when the 2D vector represents 3D ground-plane
values using +Z as forward.
ToVector3XZ(Vector2d, float)
Converts a FixedMathSharp Vector2d to a Unity Vector3 on the XZ plane, with the specified y-value.
public static Vector3 ToVector3XZ(this Vector2d vec, float y = 0)
Parameters
vecVector2dThe FixedMathSharp Vector2d to convert.
yfloatThe y-value to use in the resulting Vector3.
Returns
- Vector3
A Unity Vector3 with x/z populated from the Vector2d.
Remarks
The FixedMathSharp Y component is mapped to Unity z, preserving Unity and
FixedMathSharp's shared +Z forward convention for 3D ground-plane values.