# Asset - ScriptsTMC Vectors

#### icuurd12b42

##### TMC Founder
GMC Elder

TMC Vectors

Outputs: All

Type: Scripts

Included: Scripts, Test Object, Test Room

Demo: None

Marketplace: https://marketplace....300/tmc-vectors

Description:

Add Vector Math To GM Studio!

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

type:
tmc_vect2, tmc_vect3, tmc_vect4

You can now convert commonly found vector math examples from all over the web for your game.

Example Bounce:
Code:
``````//bounce = -2*(V dot N)*N + V
var V = tmc_vect3(hspeed,vspeed,zspeed);
var N = tmc_vect_norm(tmc_vect3(x-other.x,y-other.y,z-other.z));
varVdN2=-2*tmc_vect_dot(V,N);
varVdN2N= tmc_vect_multr(N,VdN2);
hspeed =Final[1];  //x
vspeed =Final[2];  //y
zspeed =Final[3];  //z``````
Features will be added as requested

Last edited:
J

#### Jurek Burek

##### Guest
hey!

i just bought you vector script library for game maker 2 and have a few questions. sorry for potentially dumb questions, i am just starting with game maker....

1. game maker 2 operates with stuff like direction, angle, speed (non vector)....
do you have any scripts to convert between the two (direction and speed -> 2d vector speed)?
can i apply a 2d vector (speed) to an object (so it starts moving)?
2. do you have any manual to get around all scripts (theres quite a few)?
3. can i just import the scripts or i have to import something else (objects, extensions, ...)?
4. i probably have to import all the scripts to work correctly?

thank you and take care
jure

#### icuurd12b42

##### TMC Founder
GMC Elder
1) direction and speed is converted by game maker to hspeed,vspeed and vice versa. hspeed, vspeed is a scalar in vector lingo, which you can create a vector.scalar from... and tmc_vect_dir2d, in V2, can give you an angle from the vector. it's basically a wrapper around point_direction()

2) I dont have a manual, the scripts mirror the common vector language and each function has a comment as to what it does. try not to confuse the number of functions with complexity; basically most functions wrap simple mathematical equations like add, subtract, multiply, I suggest you find a good tutorial on vectors and scalars. Also there are many duplicate function from having 2 versions in there

3) yes you can import only the scripts

4) some scripts may call other vector scripts so yes *

* I have 2 versions of the vector system, version 2, V2 is a flexible method that allows mixing vec types and V3 which is a strict version that does not allow mixing but has _in_out arguments allowing reusing existing vectors as opposed to always creating and returning a new one, which decreases memory usage and increases performance... you do not need to include both versions! also you do not need to include the systems derived from it, like the segment, pill, shape, ext,systems or the platformer stuff

#### Andrew Gilbert

##### Member
I have a quick question regarding compatibility with GMS:2. When I downloaded the package and imported it, it created some compatibility scripts. I noticed it doesn't do this if I just download the scripts. are those compatibility scripts just for the objects as they would be in V1.4?

#### Misty

##### Member
I have a quick question regarding compatibility with GMS:2. When I downloaded the package and imported it, it created some compatibility scripts. I noticed it doesn't do this if I just download the scripts. are those compatibility scripts just for the objects as they would be in V1.4?
the scripts are just scripts in the script folder.
It adds some code to the objects to put your old code as arguments to the scripts.

So for example if you had d3d_set_projection(1,2,3,4... it would change the object's code to d3d_conversion_script(1,2,3,4 and the d3d_conversion script would be a script in the script folder.

#### icuurd12b42

##### TMC Founder
GMC Elder
I have a quick question regarding compatibility with GMS:2. When I downloaded the package and imported it, it created some compatibility scripts. I noticed it doesn't do this if I just download the scripts. are those compatibility scripts just for the objects as they would be in V1.4?
The compatibility scripts are related to the demo, mainly because I'm using view stuff. on a personal note, I find it dreadful that yoyo decided to have "compatibility" script everyone is complaining about like it's cancer when those scripts are added to their project... These are very useful on their own, especially for those people used to the d3d transform functions for example, and IMHO should have remained in the gml language even if we should quietly migrate to the new stuff.