Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

.OBJ To Game Maker Studio 2 Converter

A tool that converts .obj files into Game Maker Studio 2 Text · By Sir.TotallyAverage

I need this to write each position in relation to the X, Y, Z

A topic by RustySpork created Feb 21, 2024 Views: 62 Replies: 1
Viewing posts 1 to 2

How do I go about doing that?

Alternatively, is there a way to position the model at an object's location?
Thank you-- I know it's older, but it's a great program.

Developer

Take a look at the 'Matrix Functions' page in the GMS2 Manual. The basic idea is that the converter makes a vertex_buffer which you can think of as a 3D sprite. Then to draw that 3D sprite at a particular position you simply apply a transform (matrix transform to be precise) before drawing the buffer, that way you aren't having to rebuild the entire buffer every frame, which would be very inefficient.

Here is some sample code from a basic project I had when using this:

/*

(Draw Event)

var tempMatrix = matrix_build(x, y, z, 0, direction, 0, scale, scale, scale);

matrix_set(matrix_world, tempMatrix);

vertex_submit(my_buffer, pr_trianglelist, sprite_get_texture(tx_Earth, 0));

matrix_set(matrix_world, matrix_build_identity());

*/

'z' and 'scale' were both object defined variables. In the step event I simply had 'direction += 0.2' in order to make the globe I was rendering slowly spin. In order to move the object, you would just have to change the x, y, z, values in the 'var tempMatrix = matrix_build(x, y, z, 0, direction, 0, scale, scale, scale)' line.