The WWWAnchor and WWWInline Nodes
Here we have the addition of some nifty nodes! The first one, the
WWWAnchor node, allows you to 'attach' a URL to one of your shapes.
When the user clicks on the shape, he or she will be 'transported' to
that world.
You may
specify non-.wrl URL's, but be aware that not every VRML browser will
send a non-.wrl file to the HTML browser. For example, below you see
that we've attached a URL to the wooden sphere in our world. Clicking
on the sphere will send you to Planet 9's Virtual San Francisco (a .wrl
file).
However, if, say, an .html file is attached to the
sphere, some VRML browsers will let the HTML browser handle the file.
The syntax for the node is fairly straightforward. Below we see that the
name field is where the URL goes, map
can be either NONE or POINT. If POINT is used,
coordinates of the point on the object the user clicks will be added
to the URL in the name field. The syntax for the addition is ?X, Y, Z.
The WWWInline node allows you to add other .wrl files into your world.
Thus, if you see a model on the Internet that you'd like in your world,
specify the URL for the file in the name field.
Here we've added a LARGE model of the Enterprise (as seen in Star Trek:
The Next Generation) behind our shapes.
#VRML V1.0 ascii
Separator {
PerspectiveCamera {
position 0 30 240
orientation 0 0 -1 0
focalDistance 5
heightAngle .785
} #PerspectiveCamera
SpotLight {
on TRUE
intensity .5
color 1 0 0
location 0 0 120
direction 0 0 -1
} #SpotLight
Info {
string "This is a cool world!!"
} #Info
Material {
diffuseColor 1 0 1
shininess 0.2
transparency 0
} #Material
MaterialBinding {
value DEFAULT
} #MaterialBinding
FontStyle {
size 15
family TYPEWRITER
style NONE
} #FontStyle
AsciiText {
string "This is a cool demo world!"
spacing 1
justification CENTER
width 0
} #AsciiText
Separator {
Translation {
translation 0 15 -500
} #Translation
WWWInline {
name "1701d.wrl"
} #WWWInline
} #Separator
DEF Cone1 Separator {
Translation {
translation 0 30 0
} #Translation
Cone {
parts ALL
bottomRadius 15
height 30
} #Cone
} #Cone1 Separator
DEF Cube1 Separator {
Transform {
rotation 0 1 0 .7
} #Transform
Translation {
translation -45 30 0
} #Translation
Cube {
width 30
height 30
depth 30
} #Cube
} #Cube1 Separator
DEF Cylinder1 Separator {
Translation {
translation 45 30 0
} #Translation
Cylinder {
parts ALL
radius 15
height 30
} #Cylinder
} #Cylinder1 Separator
WWWAnchor {
name "http://www.planet9.com/worlds/vrsf.wrl"
map NONE
DEF Sphere1 Separator {
Texture2 {
filename "wood4.jpg"
}
Translation {
translation 0 75 0
} #Translation
Sphere {
radius 15
}#Sphere
} #Sphere1 Separator
} #WWWAnchor
DEF FaceDiamond Separator {
DEF DiamondCoords Coordinate3 {
point [
0 75 25,
12.5 62.5 12.5,
12.5 62.5 37.5,
-12.5 62.5 37.5,
-12.5 62.5 12.5,
0 50 25,
]
} #DiamondCoords Coordinate3
USE DiamondCoords
IndexedFaceSet {
coordIndex [
0, 1, 2, -1,
0, 1, 4, -1,
0, 4, 3, -1,
0, 3, 2, -1,
5, 1, 2, -1,
5, 1, 4, -1,
5, 4, 3, -1,
5, 3, 2, -1,
]
} #IndexedFaceSet
} #FaceDiamond Separator
DEF LineDiamond Separator {
Translation {
translation 0 75 0
} #Translation
USE DiamondCoords
IndexedLineSet {
coordIndex [
0, 1, -1,
0, 2, -1,
0, 3, -1,
0, 4, -1,
4, 1, -1,
1, 2, -1,
2, 3, -1,
3, 4, -1,
5, 1, -1,
5, 2, -1,
5, 3, -1,
5, 4, -1
]
} #IndexedLineSet
} #DiamondLine Separator
} #Separator
View the world.
Move on.
Move back.
Move back to the
beginning
Page designed by Pete Clark
Last updated on Feb. 11, 1996.
E-mail me with any comments or
suggestions
Come again!