HUD Display
I don't know how i forgot i coded this. It took forever for my feeble little mind to grasp, but it finally works. VRML's diverse scripting language works a lot like javascript. With event listeners and nodes you can "ROUTE" events in VRML to and from functions, or actual geometries. WIth the advanced camera control features you can also make a HUD or head's-up display for you viewer. THis HUD will follow the viewer wherever they go through 3d space. The hud can be as simple or as complex as you want it to be. The free download is kinda complex. If this is your first vrml program, start earlier in this tutorial first.
In this example a rotating sphere with an orbiting sphere spin in the top left corner of your vrml window. Text output displays your current position in vrml space. I left the scene blank of extras so you can really sink your teeth in and pick apart this code.
If you click the sphere, a seperate vrml file is called onto the stage. All files needed to run this example are included in the zip archive. To run this, you will need a vrml browser (see tutorial home for more info). You will also need unzip to open the archive. Download the file, unzip it, open the folder and run hud.wrl in your browser to begin. CLick on the hud to load the home.wrl file included. The hud_sphere.wrl file is the rotating sphere which is inlined in the hud.wrl file. This saves you from having to scroll through all the code just for the sphere graphic. You can replace wither hud_sphere.wrl or home.wrl with your own files. Closer examination reveals the four or five lines at the bottom which controls the ROUTE controls to and from the 3d objects and functions in hud.wrl.
Click here to download the wrl archive: hud.zip
|