GameMaker (2.3)
Icon

GMLinear

FrostyCat

You must be logged in to obtain assets

Description

Overview

GMLinear is an implementation of matrix and vector operations in pure GML. You can use it to simplify many common calculations in 2D and 3D geometry and implement algorithms/formulas involving linear algebra. Hard-coded optimized functions are available for 2D, 3D and 4D vectors and 2x2, 3x3 and 4x4 matrices.

Documentation

Available on GitHub Wiki.

Examples

vec1_3d = [3, 4, 5];
vec2_3d = [1, 2, 3];
mat_3x3 = r33(
    1, 0, 0,
    0, 0, 1,
    0, 1, 0
);
vec_sum = r3_add(vec1_3d, vec2_3d); //[4, 6, 8]
dot_prod = r3_dot(vec1_3d, vec2_3d); //26
cross_prod = r3_cross(vec1_3d, vec2_3d); //[2, -4, 2]
vec_mult = r33_transform(mat_3x3, vec1_3d); //[3, 5, 4]

GMLinear is 100% open source!

Bug reports and contributions welcome on the official GitHub repository.

End User Licence Agreement (EULA).

Age Rating: 4+

Versions

GMS2 - Version 2.0.0. Published April 21, 2019

GMS2.3 - Version 2.3.0. Published September 25, 2021

Major update for compatibility with GMS 2.3.3+. If you are upgrading from an older version, please remove the extension first.

Changes

  • The extension is replaced with scripts, each script grouping together functions for a specific type. Each can be imported individually apart from each other to save compile time.
  • YYC Inlining can now be controlled via a GMLINEAR_INLINE macro.
  • All array size checks are now done using array_length, as per post-2.3 GML standards.
  • All functions that return vectors or matrices now support an optional "out" parameter for writing the result to an existing vector or matrix. Functions ending in _to are deprecated and now exist only as macro aliases.
Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait