Difference between revisions of "How to create a HUD (Head Up Display)"
m (→Link the HUD to the viewpoint) |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
The term HUD (Head Up Display) is adapted from the military, where modern fighter planes have a transparant display on which vital plane data is projected. This optic is placed directly in the line of sight of the pilot, making it possible to read the information without having to look away from the combat scene outside (hence the term "Head Up"). | The term HUD (Head Up Display) is adapted from the military, where modern fighter planes have a transparant display on which vital plane data is projected. This optic is placed directly in the line of sight of the pilot, making it possible to read the information without having to look away from the combat scene outside (hence the term "Head Up"). | ||
− | There is a new specification in the make to mix 2D and 3D content in | + | There is a new specification in the make to mix 2D and 3D content in X3D, but as long as it's not ready, we'll stick to the old-fashioned 3D (?) way... |
These are the steps to follow to create a simple hud: | These are the steps to follow to create a simple hud: | ||
Line 9: | Line 9: | ||
==Create a world== | ==Create a world== | ||
It should include: | It should include: | ||
− | * a scene | + | *a scene |
− | * a viewpoint | + | *a viewpoint |
− | * some objects to show movement across the scene | + | *some objects to show movement across the scene |
− | * a very large proximitysensor, with bounds large enough to encompass the area the user can navigate (here: "sensor") | + | *a very large proximitysensor, with bounds large enough to encompass the area the user can navigate (here: "sensor") |
==Add the HUD== | ==Add the HUD== | ||
Line 23: | Line 23: | ||
==Link the HUD to the sensor== | ==Link the HUD to the sensor== | ||
− | * ROUTE the sensor "position_changed" to the hud " | + | *ROUTE the sensor "position_changed" to the hud "translation" |
− | * ROUTE the sensor " | + | *ROUTE the sensor "oreintation_changed" to the hud "rotation" |
Done! As simple as that! | Done! As simple as that! | ||
− | |||
− | |||
− | |||
− | |||
Of course there are many things that can be added to this simple example, like scripting to alter the text as you move or switches on the dashboard... | Of course there are many things that can be added to this simple example, like scripting to alter the text as you move or switches on the dashboard... |
Latest revision as of 23:44, 24 April 2013
To make a realistic 3D experience, many implementations need some sort of window to display information to the person navigating the 3D world.
The term HUD (Head Up Display) is adapted from the military, where modern fighter planes have a transparant display on which vital plane data is projected. This optic is placed directly in the line of sight of the pilot, making it possible to read the information without having to look away from the combat scene outside (hence the term "Head Up").
There is a new specification in the make to mix 2D and 3D content in X3D, but as long as it's not ready, we'll stick to the old-fashioned 3D (?) way...
These are the steps to follow to create a simple hud:
Create a world
It should include:
- a scene
- a viewpoint
- some objects to show movement across the scene
- a very large proximitysensor, with bounds large enough to encompass the area the user can navigate (here: "sensor")
Add the HUD
- add a transform (here: "hud")
- add another transform as a child (here: "offset")
Set the offset translation to a few meters in front and to the side from the viewpoint location. This needs a little "trial and error" after adding the text, as various browsers render in different ways.
- add a text node to it (here: "hudtext")
- add the necessary code to shape the text to your likings
- if needed, add another object (like a plane or a very flat box) as a panel right behind the text for better visibility
Link the HUD to the sensor
- ROUTE the sensor "position_changed" to the hud "translation"
- ROUTE the sensor "oreintation_changed" to the hud "rotation"
Done! As simple as that!
Of course there are many things that can be added to this simple example, like scripting to alter the text as you move or switches on the dashboard...