GM:S 1.4 Drawing 3d Model Over Others

Discussion in 'Programming' started by FeetUpGaming, Apr 1, 2018.

Tags:
  1. FeetUpGaming

    FeetUpGaming Member

    Joined:
    Apr 2, 2017
    Posts:
    104
    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.
     
  2. zendraw

    zendraw Member

    Joined:
    Jun 20, 2016
    Posts:
    1,366
    perhaps draw it on a diffrent surface. havent tryed it but seems logical.
     
    FeetUpGaming likes this.
  3. FeetUpGaming

    FeetUpGaming Member

    Joined:
    Apr 2, 2017
    Posts:
    104
    I never like using surfaces but it does seem like it might work i'll give it a try. Thanks :)
     
  4. FeetUpGaming

    FeetUpGaming Member

    Joined:
    Apr 2, 2017
    Posts:
    104
    Okay i tried it and the whole screen is grey i have no idea what im doing when it comes to surfaces
     
  5. zendraw

    zendraw Member

    Joined:
    Jun 20, 2016
    Posts:
    1,366
    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.
     
  6. FeetUpGaming

    FeetUpGaming Member

    Joined:
    Apr 2, 2017
    Posts:
    104
    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.
     
  7. zendraw

    zendraw Member

    Joined:
    Jun 20, 2016
    Posts:
    1,366
    if ur room is gray originally then ur not really drawing the surface. check the manual also
     
  8. Fishman1175

    Fishman1175 Member

    Joined:
    Jul 31, 2016
    Posts:
    122
    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.
     
    Roa and FeetUpGaming like this.
  9. FeetUpGaming

    FeetUpGaming Member

    Joined:
    Apr 2, 2017
    Posts:
    104
    That just made the item vanish all together :/ i'm confused lol
     
  10. FeetUpGaming

    FeetUpGaming Member

    Joined:
    Apr 2, 2017
    Posts:
    104
    no it's like a dark grey not the rooms light grey background
     
  11. Fishman1175

    Fishman1175 Member

    Joined:
    Jul 31, 2016
    Posts:
    122
    It’s likely behind everything. Set the depth of the object to something low so that it draws last.
     
    FeetUpGaming likes this.
  12. FeetUpGaming

    FeetUpGaming Member

    Joined:
    Apr 2, 2017
    Posts:
    104
    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.
     
  13. Fishman1175

    Fishman1175 Member

    Joined:
    Jul 31, 2016
    Posts:
    122
  14. flyingsaucerinvasion

    flyingsaucerinvasion Member

    Joined:
    Jun 20, 2016
    Posts:
    2,169
    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.
     
  15. FeetUpGaming

    FeetUpGaming Member

    Joined:
    Apr 2, 2017
    Posts:
    104
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice