open.mp forum
[Library] Matrix Functions - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Releases (https://forum.open.mp/forumdisplay.php?fid=13)
---- Forum: Libraries (https://forum.open.mp/forumdisplay.php?fid=31)
---- Thread: [Library] Matrix Functions (/showthread.php?tid=1601)



Matrix Functions - Leonardo - 2021-01-27

Matrix Functions



These are matrix functions, which can be used to obtain the euler rotation of a vehicle, or calculate the offset position and offset rotation to be used in AttachObjectToVehicle/Player, also to create a DetachObjectFromVehicle/Player, etc.



Functions:


  • native Vector(Float:x, Float:y, Float:z);

  • native Matrix(const right[VECTOR], const front[VECTOR], const up[VECTOR], const pos[VECTOR]);

  • native Matrix_Invert(const matrix[MATRIX]);

  • native Matrix_BuildUp(matrix[MATRIX]);

  • native Matrix_SetRotation(matrix[MATRIX], Float:rx, Float:ry, Float:rz);

  • native Float:Matrix_GetRotationX(const matrix[MATRIX]);

  • native Float:Matrix_GetRotationY(const matrix[MATRIX]);

  • native Float:Matrix_GetRotationZ(const matrix[MATRIX]);

  • native Matrix_GetRotation(const matrix[MATRIX]);

  • native Matrix_Multiply3x3(const matrix[MATRIX], const vector[VECTOR]);

  • native Matrix_Multiply4x4(const matrix1[MATRIX], const matrix2[MATRIX]);

  • native Matrix_GetOffsetPosition(const matrix[MATRIX], const vector[VECTOR]);

  • native Matrix_GetOffsetRotation(const matrix[MATRIX], const vector[VECTOR], bool:invert = true);




Video



This is a video of the test filterscript:



[Video: https://youtu.be/vSZyMilgcuU]





Source code



https://github.com/Leonardo541/matrix