




![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Avatar
One of the most important concepts you will learn about is the Avatar. An avatar is a virtual being. Actually, it is a virtual "You". The script you write to create your avatar is the first, or main file. Your virtual world starts here and is built upon it.
The following script will create your avatar. You cannot see the avatar, but you can set the characteristics. In your virtual world, you will see everything through the eyes of the avatar. Let us go through this script one line at a time.
Line 1 - (#VRML V2.0 utf8) - This line tells the computer and VRML viewer that this is a VRML file. It must be at the top of every script.
Line 2 - (Background { ) - This is where you determine what the backdrop will look like. There are many things you can do with this node, but for now we will just go with a single color.
Line 3 - (skyColor 0.00 0.84 1.00) - This setting will produce a light blue background. If you want to change it, go to the RGB chart.
Line 4 - ( } ) - This bracket closes "Background".
Line 5 - (Group { ) - The "Group" node is used to tie together, or associate two, or more shapes.
Line 6 - ( children [ ) - Children are the shapes that make up the Group.
Line 7 - (Viewpoint { ) - This is a predefined position the Avatar will be at when the world loads.
Line 8 - (description "Forward view") - There is much to be said about Viewpoint descriptions and will be discussed at another time. For the moment, "Forward view" will suffice for our purpose.
Line 9 - (position 24.0 0.6 96.0) - Presently, your avatar is floating in cyber space and not related to anything. On line 18, we will be calling up a file called "base.wrl", which is the script for a large box (200.0 0.6 200.0), that will become the ground for the virtual world. Measuring from the center of the box, your avatar wil be placed at a point 24.0 on the X axis and 96.0 on the Y axis. The avatar eyes will be 6.0 above the ground.
Line 10 - (orientation 0.0 1.0 0.0 0.0) - At the moment, we just have the avatar standing straight up, along the Y axis, and looking forward. More detail about Orientation will come in a future discussion.
Line 11 - ( }, ) - This bracket closes "Viewpoint".
Line 12 - (NavigationInfo { ) - This node will contain the operational characteristics of the avatar.
Line 13 -(type "WALK") - There are four VRML navigation types:
"WALK" - Enables the avatar to move through the world as though it were walking. In this mode the avatar will be able to follow the terrain, walk up and down steps, and feel gravity. Walk off the edge of a building and it will fall to the ground, not just hang there in the air.
"FLY" - Enables the avatar to fly above the world.
"EXAMINE" - The avatar can turn objects, zoom in and there is no gravity.
"NONE" - There is no way for the avatar to move through the world, except by preprogramed movements.
Line 14 - (speed 0.5) - The speed setting is something of a relative term. The value of "speed", in this case 0.5, means the avatar will move one half of your distance measurement per second. So, if your world is based on feet, then the avatar will move at the rate of six inches per second, in theory. What do you suppose your speed setting would be if your virtual world was the solar system and you wanted to travel from one planet to another in about ten seconds?
Line 15 - (headlight TRUE) - The headlight is basically attached to the head of the avatar. It adds light to the view in dark places. If you do not waqnt this feature, just change it to FALSE.
Line 16 - (avatarSize 2.5 5.6 2.5) - This is where you get to specify physical(cyber physical) characteristics of your avatar. The settings, from left to right, are width, height and step. The numbers are based on the measurement you are using for your world.
The "width" of the avatar, in this case 2.5, is a true physical attribute. If you try to make the avatar walk through a 2.49 space, it will not go through.
The "height" of the avatar, in this case 5.6, is also a true physical attribute.
The "step" of the avatar, in this case 2.5, is a movement which is equivalent to you lifting your foot off of the ground to walk up stairs, or over a stone.
Line 17 - ( } ) - This bracket closes "NavigationInfo".
Line 18 - (Inline { url "base.wrl" } ) - The "Inline" function lets you bring files of other objects into your world to make it more complex. The rectangle created in base.wrl will be the ground for your world and the avatar will now have a place to stand on. You will create the base when you get to Your Worlds/World 1.
Line 19 - ( ] ) - This bracket closes "children".
Line 20 - ( } ) - This bracket closes "Group".
#VRML V2.0 utf8
Background {
skyColor 0.00 0.84 1.00
}
Group {
children [
Viewpoint {
description "Forward view"
position 24.0 6.0 96.0
orientation 0.0 1.0 0.0 0.0
},
NavigationInfo {
type "WALK"
speed 0.5
headlight TRUE
avatarSize [ 2.5, 5.6, 2.5 ]
},
Inline { url "base.wrl" }
]
}