TMC Vectors

The Mojo Collective

You must be logged in to obtain assets


Add Vector Math To GM Studio!

Vector variable type and supporting functions like add, mult, cross product, dot, and much more!

GMS:2 Compatible

Now you can convert vector math found all over the web to GML!

For this example c++ example found on the web:

VEC3 Reflect(const VEC3 &incident, const VEC3 &normal)
  return incident - 2.f * Dot(incident, normal) * normal;

Becomes this in gml

///tmc_vect_reflect(incident, normal)
//incident and normal are tmc_vect2 or tmc_vect3 types, works in 2d or 3d
return tmc_vect_sub(argument0, tmc_vect_multr( argument1, 2.0 * tmc_vect_dot(argument0, argument1)));


  1. Vector2d
  2. Vector3d
  3. Vector4d
  4. Smart Data Type using arrays
  5. Multiple Dimensional Vectors
  6. Smart Functions apply proper math to different vector types
  7. Smart Functions select proper math when vectors of different types are passed
  8. Add
  9. Subtract
  10. Divide
  11. Multiply
  12. Normalise
  13. Cross Product
  14. Dot Product
  15. Scale
  16. *Get Scalar
  17. Get Length
  18. Get Direction
  19. Math with Vector on Vector
  20. Math with Vector on real
  21. *Line Segments
  22. *Shape
  23. *Line Segment Container
  24. *Shape Container
  25. *75 Functions over 6 Data Types, and 2 container types

Vector Class Changes:

  1. Fixed a few errors in a few function
  2. Added more features to the vector class
  3. Fixed the size of the class to be identical in size no matter if 2d or 3d vector because (4)...
  4. Added the ability to store extra data to vector and all new casses

Extra Bit

  1. Added segment, shape and Pill class (*WIP)
  2. Added Platformer test and a Pill Class (*WIP)

Features will be added as requested

More info

End User Licence Agreement (EULA).

Age Rating: 4+


GMS1 - Version 3.0.1. Published June 15, 2015

Version 3 changes a few things:

  1. uses tmc_vecN as opposed to tmc_vectN,
  2. uses dedicated vec2, vec3, vec4 functions to streamline the math
  3. In this way the min(vectsizeV1,veectizeV2) and the for loop is removed
  4. whenever possible, I abstained creating interim variables
  5. Adds many variant to set data to a preexisting vector to limit the creation of temporary vectors
  6. Version 2 remains in the package untouched aside some additions and bug fixes

3.0.1 - fixes the asset update screw up dropping the demo

Privacy Policy
Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait