Jump to content


Photo

3D HUD


  • Please log in to reply
6 replies to this topic

#1 epicpiedude

epicpiedude

    Artist/GameDeveloper

  • GMC Member
  • 362 posts
  • Version:GM8

Posted 03 May 2012 - 10:05 PM

When in 3D mode, in an FPS,is there a special way to position something so you can draw it on the screen as though 3d wasn't happening (ie a heads up display).
I'm trying to draw a healthbar, but it doesn't appear in-game.

Edited by epicpiedude, 08 May 2012 - 10:59 AM.

  • 0

#2 ChefDavid22

ChefDavid22

    No, YOU shut up!

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

Posted 03 May 2012 - 10:08 PM

HUD's are basicly just objects with a depth that is in front of everything else and have no collisions code.

Make a sprite
Make an object - set the pedth to something like -100 - visible - not solid
Put the object on your screen where you want it

Is that what you mean? I see you are refering to 3d mode so I honestly dont know if depth matters there.
  • 0

#3 BattleRifle BR55

BattleRifle BR55

    Moo

  • GMC Member
  • 8294 posts
  • Version:GM7

Posted 03 May 2012 - 10:29 PM

The thing about ortho projections is that they remove any of the "special" code you would normally use in 2D (using view coordinates and the like)

So if you want to draw a sprite at 100,100, just draw it there. The projection doesn't move.
  • 0

#4 epicpiedude

epicpiedude

    Artist/GameDeveloper

  • GMC Member
  • 362 posts
  • Version:GM8

Posted 05 May 2012 - 04:39 PM

Ah. My problem is that the HUD obviously always needs to be in view...
ChefDavid22- What do you mean, put it where I want it?
In 3D, the thing is, you see from the perspective from the object.
A 2D HUD is a no-brainer.
BattleRifle BR55- I've tried that.
  • 0

#5 BattleRifle BR55

BattleRifle BR55

    Moo

  • GMC Member
  • 8294 posts
  • Version:GM7

Posted 06 May 2012 - 08:24 PM

Why not post how you tried it, and how your projection is drawn?
  • 0

#6 Jobo

Jobo

    No neurons left today

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

Posted 06 May 2012 - 08:26 PM

Your camera is using d3d_set_projection to project 3d space.
If you want to draw on-screen, as in 2D, you must change the projection you're using to draw with to 2D.

Example, in Draw event:
d3d_set_projection();
// Now we're in 3D mode
d3d_set_orthographic_projection();
// Now we're in 2D mode
d3d_set_projection();
// Now we're in 3D mode again

I'm not hundred on the function name, but it's something similar to this.

Hope this helps.
  • 0

#7 epicpiedude

epicpiedude

    Artist/GameDeveloper

  • GMC Member
  • 362 posts
  • Version:GM8

Posted 08 May 2012 - 10:38 AM

Jobo- you're my hero. That's exactly what I needed. The code is a little different, but it's the principle that worked. Everyone, thanks for your input.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users