Class Vector3dExtensions
- Namespace
- FixedMathSharp
Provides extension methods for converting between Unity Vector types and FixedMathSharp Vector3d types.
public static class Vector3dExtensions
- Inheritance
-
Vector3dExtensions
- Inherited Members
Remarks
Unity and FixedMathSharp both use +X as right, +Y as up, and +Z as
forward for 3D direction naming. These helpers therefore use direct component mappings for
Unity UnityEngine.Vector3 values instead of flipping axes.
Methods
ToVector2XY(Vector3d)
Converts a FixedMathSharp Vector3d to a Unity Vector2 using the x and y components.
public static Vector2 ToVector2XY(this Vector3d vec)
Parameters
vecVector3dThe FixedMathSharp Vector3d to convert.
Returns
- Vector2
A Unity Vector2 projected onto the XY plane.
Remarks
This projects onto Unity's XY plane and does not perform a 3D forward-axis conversion.
ToVector2XZ(Vector3d)
Converts a FixedMathSharp Vector3d to a Unity Vector2 using the x and z components.
public static Vector2 ToVector2XZ(this Vector3d vec)
Parameters
vecVector3dThe FixedMathSharp Vector3d to convert.
Returns
- Vector2
A Unity Vector2 projected onto the XZ plane.
Remarks
Unity and FixedMathSharp both use +X right and +Z forward in 3D, so this
projection preserves ground-plane direction semantics directly.
ToVector3(Vector3d)
Converts a FixedMathSharp Vector3d to a Unity Vector3.
public static Vector3 ToVector3(this Vector3d vec)
Parameters
vecVector3dThe FixedMathSharp Vector3d to convert.
Returns
- Vector3
A Unity Vector3 with the corresponding components from the FixedMathSharp Vector3d.
Remarks
This is a direct component mapping. FixedMathSharp Forward maps to
Unity UnityEngine.Vector3.forward because both use +Z as semantic forward.
ToVector3XZ(Vector3d, float)
Projects a FixedMathSharp Vector3d onto Unity's XZ plane with an explicit y-component.
public static Vector3 ToVector3XZ(this Vector3d vec, float y = 0)
Parameters
Returns
- Vector3
ToVector3d(Vector3)
Converts a Unity Vector3 to a FixedMathSharp Vector3d.
public static Vector3d ToVector3d(this Vector3 vec)
Parameters
vecVector3The Unity Vector3 to convert.
Returns
- Vector3d
A FixedMathSharp Vector3d with the corresponding components from the Unity Vector3.
Remarks
This is a direct component mapping. Unity UnityEngine.Vector3.forward maps to
FixedMathSharp Forward because both use +Z as semantic forward.
ToVector3dXY(Vector2, float)
Converts a Unity Vector2 to a FixedMathSharp Vector3d on the XY plane.
public static Vector3d ToVector3dXY(this Vector2 vec, float z = 0)
Parameters
vecVector2The Unity Vector2 to convert.
zfloatThe z-value for the Vector3d's z-component.
Returns
- Vector3d
A FixedMathSharp Vector3d with the given components.
Remarks
The supplied z fills FixedMathSharp Z.
ToVector3dXZ(Vector2, float)
Converts a Unity Vector2 to a FixedMathSharp Vector3d on the XZ plane.
public static Vector3d ToVector3dXZ(this Vector2 vec, float y = 0)
Parameters
vecVector2The Unity Vector2 to convert.
yfloatThe y-value for the Vector3d's y-component.
Returns
- Vector3d
A FixedMathSharp Vector3d with the given components.
ToVector4(Vector3d, float)
Converts a FixedMathSharp Vector3d to a Unity Vector4, assigning a specified w-value for the Vector4's w-component.
public static Vector4 ToVector4(this Vector3d vec, float w = 0)
Parameters
vecVector3dThe FixedMathSharp Vector3d to convert.
wfloatThe w-value for the resulting Vector4's w-component.
Returns
- Vector4
A Unity Vector4 with the x, y, and z components from the FixedMathSharp Vector3d and the specified w-component.
Remarks
This is a direct component mapping for homogeneous/vector data and does not perform an axis conversion.