Jump to content


Photo

3d Model Problem


  • This topic is locked This topic is locked
8 replies to this topic

#1 epicpiedude

epicpiedude

    Artist/GameDeveloper

  • GMC Member
  • 381 posts
  • Version:GM:Studio

Posted 24 April 2012 - 10:53 PM

So I'm making a third-person shooter. At one point the player gets attacked by a tank.
The tank's model is not drawing, and I'm really confused.
Here's the code pieces that should draw a tank:
The code for the Create event:
//Here's where the model is created and readied.
model=d3d_model_create();
d3d_model_load(model,"C:/Documents and Settings/Ryan/My Documents/GMP/Sprite/Models/tank.d3d");
The code for the Draw Event:
//Draw the Model
d3d_model_draw(model,x,y,16,background_get_texture(texture_floor));

  • 0

#2 Misu

Misu

    Awesometasticness!

  • GMC Member
  • 494 posts
  • Version:GM:Studio

Posted 24 April 2012 - 11:36 PM

1. Make sure the file is in that directory.
2. Sometimes the models are there but the position is base on how it was drawn from whatever program you use. What program do you use to draw it?
3. Try closing the drawing code like this:
d3d_transform_set_identity()
d3d_transform_set_translation(x,y,0)
d3d_model_draw(model,0,0,16,background_get_texture(texture_floor));
d3d_transform_set_identity()

EDIT: Dumb of me, I haven't realized the model is made from the program. Perhaps it is not saved correctly. Try checking whats written in that file to see if it did saved the vertex.

Edited by MisuMen49, 24 April 2012 - 11:43 PM.

  • 0

#3 epicpiedude

epicpiedude

    Artist/GameDeveloper

  • GMC Member
  • 381 posts
  • Version:GM:Studio

Posted 25 April 2012 - 10:19 AM

The file is in that directory.
I tried your code and it still had the same result.
Also, I did make the model in Sketchup, export it as a .obj, and use a .obj to .d3d converter.
Maybe that has something to do with it?
  • 0

#4 Misu

Misu

    Awesometasticness!

  • GMC Member
  • 494 posts
  • Version:GM:Studio

Posted 25 April 2012 - 10:37 AM

Also, I did make the model in Sketchup, export it as a .obj, and use a .obj to .d3d converter.
Maybe that has something to do with it?


Well I never converted an *.obj to a *.d3d but if you want to import *.obj models, you can use some model importing scripts from the internet. I recommend d3d_model_load_ext. You should google that. :happy:
  • 0

#5 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Retired Staff
  • 15731 posts
  • Version:GM:Studio

Posted 25 April 2012 - 06:46 PM

Also, I did make the model in Sketchup, export it as a .obj, and use a .obj to .d3d converter.

Which one??
  • 0

#6 epicpiedude

epicpiedude

    Artist/GameDeveloper

  • GMC Member
  • 381 posts
  • Version:GM:Studio

Posted 25 April 2012 - 06:55 PM

I used http://sandbox.yoyog...m/games/175476.
  • 0

#7 epicpiedude

epicpiedude

    Artist/GameDeveloper

  • GMC Member
  • 381 posts
  • Version:GM:Studio

Posted 25 April 2012 - 07:11 PM

Okay, so I decided to try to figure out exactly where the problem was happening. I changed the code that loaded the model to a code that just made the model a cube.
It worked.
So obviously there's something wrong with my model.
I'll see about d3d_model_load_ext to see if the problem is with my .obj file or the final .d3d file.
  • 0

#8 epicpiedude

epicpiedude

    Artist/GameDeveloper

  • GMC Member
  • 381 posts
  • Version:GM:Studio

Posted 25 April 2012 - 07:21 PM

Okay, so something's wrong with my .obj file.
Figures, because that's the one thing I can't seem to be able to find an alternative for.
I have no other way to do a .obj file, so I pretty much have to figure out how to use Game Maker's model building functions.

Oh. I figured out the problem.
Transfering from Sketchup to .obj apparently converts one Sketchup meter into one pixel. It works fine even with the code I had but it is about three pixels across. Still, everyone, thanks for your input!
  • 0

#9 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Retired Staff
  • 15731 posts
  • Version:GM:Studio

Posted 25 April 2012 - 07:22 PM

That's why I wrote GMModelFix... get it, in my tools page. most obj loader on the gmc fail loading 80% of the obj models out there.

1 3d unit (it's not a pixel BTW) is usually 1 meter...
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users