JaimitoEs
Member
Hi everyone! I´m finishing the GMS2 version of my editor, but I have encountered a problem that leads me, I put you in situation:
In GMS1, to handle an orthographic 3d plane, what I do is transform the matrices into the draw event of my camera when the 3d is activated, in this way I get the desired perspective and i can toggle between 2d-3d.
Remaining our code for the draw event:
I have already read the entire manual on the new camera functions to see if this method was compatible with GMS2. I have seen that the projection has changed, and if I propose the same method as in GMS1 to create the perspective, I see that the Y axis is inverted, so far so good, I change the value to positive but, my plane has no perspective. I decide to replicate the GMS1 projection and set this to the default camera (view_camera [0]), and I get the exact perspective I had! I already have 3D! But there comes another problem, I totally lose control over the editor, the traditional 2D coordinates axis stops working. It made me think that I should control my camera as if it were 2d and draw the perspective from the Draw event of the camera, so I decide to pass the GMS1 projection matrix directly in this event. Good news, I have control of the editor again, but the camera draws the stage from its point of origin in the world (32000, or 16000 seems to be looking the image...).
Any idea how to make the GMS1 projection matrix compatible for GMS2?
Last Try GMS2 passing the old projection matrix:
Create event : Proj = [2,0,0,0,0,3.56,0,0,0,0,1.00,1,-0.00,0.00,-0.00,0]///Default Gms1 Projection.
and the Draw event:
The result
If i set the projection from the function "camera_set_proj_mat" in the "Create event", the world is represented correctly, but i loose the tradicional 2d x/y coordinate system.
Also i see when i draw from the Gui in a depth <= 0, the input boxes are not drawn, I guess it has to do with leaving the zbuffer drawing region... but i´m confused in this moment.
Edit 1: I have a new track that confuses me even more, some terrains are drawn in cullOn mode, and these are not represented on the screen, it makes me think that the projection is reversed, but I am not able to reverse it ...
Any idea where I may be failing? Thanks in advance.
Code:
/*
///GMS1 Activating the z-buffer
{ { 1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1 }, }///Default World
{ { 1,0,0,0,0,1,0,0,0,0,1,0,-640,-360,1920,1 }, }Default View
{ { 2,0,0,0,0,3.56,0,0,0,0,1.00,1,-0.00,0.00,-1.00,0 }, }Default Projection
///GMS2 Activating the z-buffer
{ { 1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1 }, }///Default World
{ { 1,0,0,0,0,1,0,0,0,0,1,0,-640,-360,16000,1 }, }Default View
{ { 0.00,0,0,0,0,-0.00,0,0,0,0,0.00,0,0,0,0,1 }, }Default Projection
*/
Create event:
Proj = [2,0,0,0,0,3.56,0,0,0,0,1.00,1,-0.00,0.00,-0.00,0];
Remaining our code for the draw event:
Code:
if(start_3d)
{
var m = matrix_build(0,0,-
z,y_rotation,x_rotation,z_rotation,1,-1,1);
var v = matrix_get(matrix_view);
var f = matrix_multiply(v,m);
matrix_set(matrix_view,f);
}
Any idea how to make the GMS1 projection matrix compatible for GMS2?
Last Try GMS2 passing the old projection matrix:
Create event : Proj = [2,0,0,0,0,3.56,0,0,0,0,1.00,1,-0.00,0.00,-0.00,0]///Default Gms1 Projection.
and the Draw event:
Code:
if(start_3d)
{
matrix_set(matrix_projection, Proj);
var m = matrix_build(0,0,- z,y_rotation,x_rotation,z_rotation,1,-1,1);
var v = matrix_get(matrix_view);
var f = matrix_multiply(v,m);
matrix_set(matrix_view,f);
}
If i set the projection from the function "camera_set_proj_mat" in the "Create event", the world is represented correctly, but i loose the tradicional 2d x/y coordinate system.
Also i see when i draw from the Gui in a depth <= 0, the input boxes are not drawn, I guess it has to do with leaving the zbuffer drawing region... but i´m confused in this moment.
Edit 1: I have a new track that confuses me even more, some terrains are drawn in cullOn mode, and these are not represented on the screen, it makes me think that the projection is reversed, but I am not able to reverse it ...
Any idea where I may be failing? Thanks in advance.
Last edited: