GMS 2 GML Camera move

J

Jurek Burek

Guest
hey!

when i use:

camera_set_view_pos(view_camera[0], 110, 510);

to move around the room, it works fine.
but then i make my own camera:

camera = camera_create();
var pm = matrix_build_projection_ortho(1920, 1080, 1, 5000);
var vm = matrix_build_lookat(960, 540, -10, 960, 540, 0, 0, 1, 0);
camera_set_proj_mat(camera, pm);
camera_set_view_mat(camera, vm);
view_camera[0] = camera;

and i works fine by itself. but when i add the first line:

camera_set_view_pos(view_camera[0], 110, 510);

everything goes black, dissapears. even the smallest change in camera position makes this.
what am i missing? i just want to move around the room with my own made camera.....

please help, i am stuck with this for a week....

thx
 

Jakylgamer

Member
you also need these if youre not setting in the room properties.
Code:
view_enabled = true;
view_set_visible(view_index, true);
also you need to update the view matrix

dont use camera_set_view_pos();
 
Last edited:
Top