User`s guide
1 Getting Started
1-16
# This is a comment line
WorldInfo {
title "Bouncing Ball"
}
Viewpoint {
position 0 5 30
description "Side View"
}
DEF Floor Box {
size 6 0.2 6
}
DEF Ball Transform {
translation 0 10 0
children Shape {
appearance Appearance {
material Material {
diffuseColor 1 0 0
}
}
geometry Sphere {
}
}
}
The first line is the VRML header line. Every VRML file must start with this header line.
It indicates that this is a VRML 2 file and that the text objects in the file are encoded
according to the UTF8 standard. You use the number sign (#) to comment VRML worlds.
Everything on a line after the # sign is ignored by a VRML viewer, with the exception of
the first header line.
Most of the box properties are left at their default values – distance from the center
of the coordinate system, material, color, and so on. Only the name Floor and the
dimensions are assigned to the box. To be able to control the position and other
properties of the ball, it is defined as a child node of a Transform type node. Here,
the default unit sphere is assigned a red color and a position 10 m above the floor. In
addition, the virtual world title is used by VRML viewers to distinguish between virtual
worlds. A suitable initial viewpoint is defined in the virtual world VRML file.
When displayed in a VRML viewer, the floor and red ball look like this: