Legacy GM Drawing 3d Model Over Others

Hey, i'm trying to draw a 3d model that is in the players "hand" so it's close to the camera but it clips through walls. So i would like to know how to draw it above every other model so it's always visible and wont clip. I have tried the d3d_set_zwriteenable() thing but that didn't do anything.
 
Z

zendraw

Guest
i dont use them alot either. but basically u draw the stuff on a surface and then draw the surface. maybe u shuld disable the application surface also, do it first in 2d, not sure if it works in 3d. some1 shuld enlighten the situation.
 
i dont use them alot either. but basically u draw the stuff on a surface and then draw the surface. maybe u shuld disable the application surface also, do it first in 2d, not sure if it works in 3d. some1 shuld enlighten the situation.
yeah i created the surface, cleared it to transparent, drew the item on it then i drew the surface but it's just a grey screen.
 
Z

zendraw

Guest
if ur room is gray originally then ur not really drawing the surface. check the manual also
 
F

Fishman1175

Guest
d3d_set_hidden(false)
draw model
d3d_set_hidden(true)

I think that should do it as long as you draw the model last. No need for surfaces.
 
It’s likely behind everything. Set the depth of the object to something low so that it draws last.
Okay that got the desired effect but now it looks very strange. I think it has something to with the model being made of lots of cubes so it's now drawing faces of the cubes which shouldn't be drawn. So i have a choice, have a strange looking item in the hand or one that goes through walls.
 
Well if you durn off d3d_set_hidden or d3d_set_zwriteenable, you might get parts of your model showing through other parts, when that isn't supposed to happen. What you'd ideally want to do is to clear the contents of the zbuffer. For some reason gamemaker doesn't give us access to that. But I believe there are round-about ways of clearing it. I know it will do that if you set a new surface as the target.
 
Ok, looking at the docs now, I think you were on the right track. https://docs.yoyogames.com/source/dadiospice/002_reference/drawing/drawing 3d/3d setup/d3d_set_zwriteenable.html

Replace d3d_set_hidden with d3d_set_zwriteenable. I think it didn’t work before because you still need to draw the object last.
Yeah i just tried using d3d_set_zwriteenable and same problem the blocks are showing through. Don't think i'm going to be able to sort it out. There is something i could try but it would mean not drawing the items as blocks but as faces and when there is an edge draw the side of the block but i think the back face edges will still show through.
 
Top