samp.directory
← Scripts and libraries

Leonardo541/matrix

Matrix Functions for SA-MP

Filterscript★ 5updated Jun 2021MITPawn
Open on GitHub

README.md

Matrix Functions for SA-MP

https://youtu.be/vSZyMilgcuU

Functions (matrix.inc)

returnfunction
VECTORVector(Float:x, Float:y, Float:z);
MATRIXMatrix(const right[VECTOR], const front[VECTOR], const up[VECTOR], const pos[VECTOR]);
MATRIXMatrix_Invert(const matrix[MATRIX]);
Matrix_BuildUp(matrix[MATRIX]);
Matrix_SetRotation(matrix[MATRIX], Float:rx, Float:ry, Float:rz);
floatFloat:Matrix_GetRotationX(const matrix[MATRIX]);
floatFloat:Matrix_GetRotationY(const matrix[MATRIX]);
floatFloat:Matrix_GetRotationZ(const matrix[MATRIX]);
VECTORMatrix_GetRotation(const matrix[MATRIX]);
VECTORMatrix_Multiply3x3(const matrix[MATRIX], const vector[VECTOR]);
MATRIXMatrix_Multiply4x4(const matrix1[MATRIX], const matrix2[MATRIX]);
VECTORMatrix_GetOffsetPosition(const matrix[MATRIX], const vector[VECTOR]);
VECTORMatrix_GetOffsetRotation(const matrix[MATRIX], const vector[VECTOR], bool:invert = true);

Functions (matrix_example.inc)

returnfunction
MATRIXGetVehicleMatrix(vehicleid);
SetVehicleMatrix(vehicleid, mat[MATRIX]);
VECTORGetVehicleRot(vehicleid);
SetVehicleRot(vehicleid, rot[VECTOR]);
VECTORGetVehicleVelocityFrontVector(vehicleid)
SetVehicleVelocityFrontVector(vehicleid, vec[VECTOR]);

Commands (matrix_example1.pwn)

commanddescription
/matrixStart/Stop comparison between matrix, attach and i_quat
/attachAttach object to vehicle, with predefined offset
/attach_calc_offsetAttach object to vehicle, automatically calc offset
/detachdetach object from vehicle

Commands (matrix_example2.pwn)

commanddescription
/getvrotExample of GetVehicleRot
/setvrotExample of SetVehicleRot
/boostExample of SetVehicleVelocityFrontVector
/turboSame result as /boost

Thank to

IllidanS4 for i_quat, It allowed me to create the Matrix_BuildUp function based on GetVehicleRotationQuatFixed.
Zeex for amx_assembly, it allowed me to create the GetVehicleMatrix and SetVehicleMarix function. Thanks for that.
katursis for Pawn.RakNet, it allowed me to create the SetVehicleMarix function. Thanks for that.

This page is built from what GitHub publishes about the repository. samp.directory does not host the code. Report a problem with this listing

Leonardo541/matrix: SA-MP Filterscript | samp.directory