3D D3D Models Not Drawing anymore...

Merrick82

Member
Hi Community, hoping you can help me figure this out: I've been importing some models I made and textured in Model Creator (a simple Chest for example). Everything was working fine for a while and suddenly all D3D models stopped working one day.

In the textures I checked to see if I accidentally unchecked Use For 3D. Still checked.

So I stripped down the game to its bare bones, just a Camera Object, the Chest Object and a Floor Object is left.... and still the chest model is not getting drawn. Here is all the code remaining:

The Camera Object
///CREATE EVENT

depth = 10000; //camera object is initially set to depth -10000 in object editor
d3d_start();
d3d_set_culling(false);
draw_set_alpha_test_ref_value(20);
draw_set_alpha_test(true);
d3d_set_hidden(0);
display_reset(0,true);
draw_set_colour(c_white);

//Set Mouse to Centre
display_mouse_set(display_get_width()/2,display_get_height()/2);

//Camera Mouse-Look Variables
pitch = 0;
direction = 0;
height = 16;
xto = x+10;
yto = y;
zto = height;
///STEP EVENT

//Mouse-Look Direction Controls
var lock = !keyboard_check(vk_alt);
if (lock)
{
//Calculate Direction
direction -= (display_mouse_get_x()-display_get_width()/2)/10;
pitch -= (display_mouse_get_y()-display_get_height()/2)/10;
pitch = clamp(pitch,-80,80);

//Reset Mouse Position to Center of Screen
var center_x = display_get_width()/2;
var center_y = display_get_height()/2;
display_mouse_set(center_x,center_y);

}

//Calculate Camera Turning
var d = degtorad(direction);
var zd = degtorad(pitch);
xto = x+cos(d) * abs(sin(zd)+sign(-pitch));
yto = y-sin(d) * abs(sin(zd)+sign(-pitch));
zto = height + sin(zd);


The Chest Object
///CREATE EVENT
closed_model = d3d_model_create();
open_model = d3d_model_create();
d3d_model_load(closed_model, "chest_1_closed.gmmod");
d3d_model_load(open_model, "chest_1_open.gmmod");
current_model = closed_model;

z = 0;
height = 10;
x_size = sprite_get_width(mask_index)*image_xscale; // for collisions, but i stripped that out too.
y_size = sprite_get_height(mask_index)*image_yscale; //....


///DRAW EVENT
d3d_model_draw(current_model,x,y,0,background_get_texture(tex_chest_1));

The Floor Object (stretchable)
///CREATE EVENT
tex_img = background_get_texture(tex_cave_floor_1);
z = -5; //negative to give it thickness within code only
height = 5;
x_size = sprite_get_width(mask_index)*image_xscale; // for collisions, but i stripped that out too.
y_size = sprite_get_height(mask_index)*image_yscale; //....

///DRAW EVENT
var w = image_xscale*16;
var h = image_yscale*16;
d3d_draw_floor(x, y+h, z+height, x+w,y ,z+height, tex_img ,w/16, h/16);


So there it is... just three objects. And again, this was working fine, but obviously there's something I'm having a brain fog about now, so I'm hoping the community can help me clear it.
 
Last edited:

Merrick82

Member
Hidden should be set to 1, not 0. I'd start there. Without knowing its scale, my best guess is that the floor is drawing over it.
Thank you for the reply. Yes, I turned hidden to 0 earlier in my problem solving of this issue, I now put it back to 1.

- I edited the Floor Object so it now sits at z = 0 with height = 0. It is a plane stretched along x and y from 0,0 to room_width,room_height.
- the Chest Object's z origin is at the base of the model and it is sitting at z = 0. I played around with different z values for it, sadly it had no effect.
 

Merrick82

Member
Further Update: The problem persists. After I created a new project and recreated the game, the problem reappeared, that is to say: the d3d models are not being drawn (the player object still collides with the their masks though)

I returned to probing in the stripped down version of the project where the problem also still exists, but I'm not sure where to continue investigating.

Any ideas where to begin probing at this issue would be appreciated. I'm feeling at a loss.
 
Last edited:
Top