• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - IDE Z axis troubles

Roa

Member
So uhh.. whats the deal with the z axis? negative is now "up". I know someone is going to tell me not to think so black and white on this matter, but its just inconsistent with all other versions of gamemaker, so come time when people can import projects over, everything will be inverted.
 
Last edited:

Roa

Member
-z has always been up... depth = -1000 vs depth = 1000 should give a clue about that ;)
...no..? Not talking about the depth which weasels over to z values if needed.

when drawing the z position of a vertex, positive values now go downwards, and Im positive thats inverted from now. Someone clued me in that its possibly to comply with proper directX standards.

[edit]

Ok, so yeah... No. Just checked it again to make sure I wasn't having a mental fit. Adding to the Z value from the same code transferred over clearly makes them go in opposite directions. Its definitely inverted. Try it out yourself.
 
Last edited:

icuurd12b42

TMC Founder
GMC Elder
This is the proper 3d cam for studio... This setup is 200 units above ground looking north (-y). drop the cam in the bottom of the room

execute code:

depth = 1000000
z = -200;
vecFacing = d3d_transform_vertex(0,-1,0);
vecUp = d3d_transform_vertex(0,0,-1);


Draw Event:
execute code:

//set the proper 3d
d3d_start();
d3d_set_culling(1);
draw_set_alpha_test(1);
draw_set_alpha_test_ref_value(128);
d3d_set_hidden(true);
aspect = view_wport/view_hport;
d3d_set_projection_ext(x,y,z,x+vecFacing[0],y+vecFacing[1],z+vecFacing[2],vecUp[0],vecUp[1],vecUp[2],59,-aspect,1,32000);

admittedly I think you are right, in studio they inverted something because note the -aspect. and I think you may need to flip the models inside out with add_scaling(1,1,-1) but I'm basing this with memory fragments of like 4 projects
 

Roa

Member
This is the proper 3d cam for studio... This setup is 200 units above ground looking north (-y). drop the cam in the bottom of the room

execute code:

depth = 1000000
z = -200;
vecFacing = d3d_transform_vertex(0,-1,0);
vecUp = d3d_transform_vertex(0,0,-1);


Draw Event:
execute code:

//set the proper 3d
d3d_start();
d3d_set_culling(1);
draw_set_alpha_test(1);
draw_set_alpha_test_ref_value(128);
d3d_set_hidden(true);
aspect = view_wport/view_hport;
d3d_set_projection_ext(x,y,z,x+vecFacing[0],y+vecFacing[1],z+vecFacing[2],vecUp[0],vecUp[1],vecUp[2],59,-aspect,1,32000);

admittedly I think you are right, in studio they inverted something because note the -aspect. and I think you may need to flip the models inside out with add_scaling(1,1,-1) but I'm basing this with memory fragments of like 4 projects
what I mean to say is that GMS2 is inverted compared to all other versions, including studio 1.4 Up on Z has always been positive...until Studio 2.. where its strangely the opposite with no mention in the changes I have seen. Again, its not super bad until someone tries to import. Its just inconsistent. Ive transferred the same perspectives and draw codes between projects and even got some numbers from debug. They just decided to flip it or something.
 

icuurd12b42

TMC Founder
GMC Elder
Well maybe that will fix the -aspect thing in my code. but I assure you -z has always been up respectively to depth if you wanted to merge 3d and 2d without the need to mess with the 2d draw event and add floors and transforms...

Most 3d examples have the +z going up which has always been technically wrong. Basically because your camera pointing down to the ground should in fact result in the same view perspective as having no camera at all, culling on with nothing disappearing.

But it's a matter of perspective. you are basically in charge of your camera position and orientation and scene drawing so it mattered little if you were walking on the ground looking down or walking under the ground looking up aside maybe having the extra cost of needing more transforms...

And I know gm8 and studio did not have the same camera, something got inverted in studio, in fact I was in your shoes when I switched to studio from gm8. so I feel your pain
 
Top