diff --git a/Raylib-cs/Raymath.cs b/Raylib-cs/Raymath.cs
index d3c03ea..32775de 100644
--- a/Raylib-cs/Raymath.cs
+++ b/Raylib-cs/Raymath.cs
@@ -225,6 +225,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Unproject(Vector3 source, Matrix4x4 projection, Matrix4x4 view);
+ /// Get Vector3 as float array
+ [DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern float3 Vector3ToFloatV(Vector3 v);
+
/// Compute matrix determinant
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
@@ -313,6 +317,10 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixLookAt(Vector3 eye, Vector3 target, Vector3 up);
+ /// Get float array of matrix data
+ [DllImport(Raylib.nativeLibName, CallingConvention = CallingConvention.Cdecl)]
+ public static extern float16 MatrixToFloatV(Matrix4x4 m);
+
/// Add 2 quaternions
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
diff --git a/Raylib-cs/Rlgl.cs b/Raylib-cs/Rlgl.cs
index 1a1273f..d515eb3 100644
--- a/Raylib-cs/Rlgl.cs
+++ b/Raylib-cs/Rlgl.cs
@@ -104,18 +104,11 @@ namespace Raylib_cs
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void rlMultMatrixf(float* matf);
- public static void rlMultMatrixf(ref Matrix4x4 matf)
+ ///
+ public static void rlMultMatrixf(Matrix4x4 matf)
{
- var pinned = new GCHandle();
- try
- {
- pinned = GCHandle.Alloc(matf, GCHandleType.Pinned);
- rlMultMatrixf((float*)pinned.AddrOfPinnedObject());
- }
- finally
- {
- pinned.Free();
- }
+ float16 f = Raymath.MatrixToFloatV(matf);
+ rlMultMatrixf(f.v);
}
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]