• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Is the "up" vector actually the "down" vector?

Anixias

Member
Code:
var matrix = matrix_build_lookat(x++, 0, z++, room_width, room_height, 0, 0, 0, 1);
This seems to render everything upside-down, where +z is actually down, even though the up-vector is stated as 0,0,1. What's going on?

I'm using x++ and z++ to simply move the camera around temporarily while I get 3D rendering to work. However, the zup component seems to actually be a zdown component... Meaning, if I set the up-vector to 0,0,-1, everything stops being upside-down. But, isn't this making -z up and +z down? Why is it reversed?

EDIT:
changing it to 0,0,-1 actually reversed x and y as well. Rendering at -camz fixes everything, but why does it have to be negative?
 
Last edited:
If you were to put your eye exactly where the camera is located, looking in the direction the camera is looking, then the up vector is the direction the top of your head is pointing. EXCEPT the y-axis is flipped when drawing normally, which fouls things up. What I'd really like to know is on what level is the y axis flipped? I have a feeling it is just the way the projection matrix is composed.

If I make the following changes to the projection matrix, while d3d_start Is NOT in effect, then the up vector seems to make sense, and everything continues to draw in the normal orientation. Which makes me wonder why the projection matrix is composed the way it is. Anyone have further insight on this?

var m = matrix_get(matrix_projection);
m[0] = -m[0];
m[5] = -m[5];
m[12] = 0;
m[13] = 0;
matrix_set( matrix_projection, m);
 
Last edited:
Top