Controlling navigation
playyard.wrl

	

#VRML V2.0 utf8
#
#  playyard.wrl
#  A playyard to demonstrate NavigationInfo
#	by John L. Moreland
#
#  This world illustrates the use of a NavigationInfo node to set
#  the size of the user's avatar (width, height, stepsize).  The
#  playyard contains several obstacles, some of which the users
#  can get past and others they can't, all because of the size of
#  the avatar.
#

WorldInfo {
    title "Playyard"
    info [ "Copyright (c) 1998, John L. Moreland" ]
}

NavigationInfo {
	avatarSize [ 0.25, 1.6, 0.6 ]
	type [ "WALK", "ANY" ]
	headlight FALSE
	speed 2.0
}

# Sky & Grass

Background {
	skyColor [
		0.0 0.2 0.7,
		0.0 0.5 1.0,
		1.0 1.0 1.0
	]
	skyAngle [ 1.309, 1.571 ]
	groundColor [
		0.0 0.1 0.0,
		0.0 0.2 0.0,
		0.2 0.5 0.2,
	]
	groundAngle [ 1.309, 1.571 ]
}

# Lights

DirectionalLight {
	ambientIntensity 0.5
	direction -0.5 -1.0 -0.5
}

# Viewpoints

Viewpoint {
	description "Away"
	position 0.0 5.5 9.0
	orientation 1.0 0.0 0.0  -0.57
}

Viewpoint {
	description "Monkey Bars - End"
	position -4.0 1.6 4.0
}

Viewpoint {
	description "Monkey Bars - Side"
	position 0.0 1.6 0.0
	orientation 0.0 1.0 0.0  1.57
}

Viewpoint {
	description "Chin-Up Bar - Short"
	position -1.0 1.6 -2.0
	orientation 1 0 0  -0.57
}

Viewpoint {
	description "Chin-Up Bar - Tall"
	position 1.0 1.6 0.0
}

Viewpoint {
	description "Slide - Ladder"
	position 4.0 1.6 4.0
	orientation 1.0 0.0 0.0  -0.57
}

Viewpoint {
	description "Slide - Shoot"
	position 4.0 1.6 -4.0
	orientation 0.0 1.0 0.5  3.14159
}

# Ground

Shape {
	appearance Appearance {
		material Material {
#			diffuseColor 1.0 0.5 0.3
		}
		texture ImageTexture {
			url "sand.jpg"
		}
		textureTransform TextureTransform {
			scale 16.0 16.0
		}
	}
	geometry Box {
		size 10.0 0.02 10.0
	}
}

# Trees

# Tree (Rear)
Transform {
	translation 2.0 0.0 -10.0
		children [
		DEF Palm Billboard {
			children [
				# Tree
				Shape {
					appearance Appearance {
						material NULL  # emissive texturing
						texture ImageTexture { url "palm.png" }
					}
					geometry IndexedFaceSet {
						coord Coordinate {
							point [
								-0.83  0.0  0.0,
								 0.83  0.0  0.0,
								 0.83 3.75 0.0,
								-0.83 3.75 0.0,
							]
						}
						coordIndex [ 0, 1, 2, 3 ]
						texCoord TextureCoordinate {
								point [
										0.0 0.0,
										1.0 0.0,
										1.0 1.0,
										0.0 1.0,
								]
						}
						texCoordIndex [ 0, 1, 2, 3 ]
						solid FALSE
					}
				}
				# Tree shadow
				Shape {
					appearance Appearance {
						material Material {
								diffuseColor 0.0 0.0 0.0
								transparency 0.5
						}
						texture ImageTexture { url "palmsh.png" }
					}
					geometry IndexedFaceSet {
						coord Coordinate {
							point [
								-1.0  0.02  1.0,
								 1.0  0.02  1.0,
								 1.0  0.02 -1.0,
								-1.0  0.02 -1.0,
							]
						}
						coordIndex [ 0, 1, 2, 3 ]
						texCoord TextureCoordinate {
								point [
										0.0 0.0,
										1.0 0.0,
										1.0 1.0,
										0.0 1.0,
								]
						}
						texCoordIndex [ 0, 1, 2, 3 ]
						solid FALSE
					}
				}
			]
		}
	]
}
# Tree (left)
Transform {
	translation -6.0 0.0 -1.0
	children USE Palm
}

# Storm Fence

Group {
	children [
		DEF Fence Transform {
			translation 0.0 0.0 -5.0
			children [
				Shape {
					appearance Appearance {
						material Material { }
						texture ImageTexture {
							url "grill.png"
						}
						textureTransform TextureTransform {
							rotation 0.7853981750
							scale 17.0 17.0
							center 0.5 0.5
						}

					}
					geometry IndexedFaceSet {
						solid FALSE
						coord Coordinate {
							point [
								# Right 5
								 4.0 0.0 0.0,
								 5.0 0.0 0.0,
								 5.0 1.0 0.0,
								 4.0 1.0 0.0,
								# Right 4
								 3.0 0.0 0.0,
								 4.0 0.0 0.0,
								 4.0 1.0 0.0,
								 3.0 1.0 0.0,
								# Right 3
								 2.0 0.0 0.0,
								 3.0 0.0 0.0,
								 3.0 1.0 0.0,
								 2.0 1.0 0.0,
								# Right 2
								 1.0 0.0 0.0,
								 2.0 0.0 0.0,
								 2.0 1.0 0.0,
								 1.0 1.0 0.0,
								# Right 1
								 0.0 0.0 0.0,
								 1.0 0.0 0.0,
								 1.0 1.0 0.0,
								 0.0 1.0 0.0,
								# Left 1
								-1.0 0.0 0.0,
								 0.0 0.0 0.0,
								 0.0 1.0 0.0,
								-1.0 1.0 0.0,
								# Left 2
								-2.0 0.0 0.0,
								-1.0 0.0 0.0,
								-1.0 1.0 0.0,
								-2.0 1.0 0.0,
								# Left 3
								-3.0 0.0 0.0,
								-2.0 0.0 0.0,
								-2.0 1.0 0.0,
								-3.0 1.0 0.0,
								# Left 4
								-4.0 0.0 0.0,
								-3.0 0.0 0.0,
								-3.0 1.0 0.0,
								-4.0 1.0 0.0,
								# Left 5
								-5.0 0.0 0.0,
								-4.0 0.0 0.0,
								-4.0 1.0 0.0,
								-5.0 1.0 0.0,
							]
						}
						coordIndex [
							 0,  1,  2,  3, -1
							 4,  5,  6,  7, -1
							 8,  9, 10, 11, -1
							12, 13, 14, 15, -1
							16, 17, 18, 19, -1
							20, 21, 22, 23, -1
							24, 25, 26, 27, -1
							28, 29, 30, 31, -1
							32, 33, 34, 35, -1
							36, 37, 38, 39, -1
						]
						texCoord TextureCoordinate {
							point [
								0.0 0.0,  1.0 0.0,
								1.0 1.0,  0.0 1.0,
							]
						}
						texCoordIndex [
							0, 1, 2, 3, -1,
							0, 1, 2, 3, -1,
							0, 1, 2, 3, -1,
							0, 1, 2, 3, -1,
							0, 1, 2, 3, -1,
							0, 1, 2, 3, -1,
							0, 1, 2, 3, -1,
							0, 1, 2, 3, -1,
							0, 1, 2, 3, -1,
							0, 1, 2, 3, -1,
						]
						# size 10.0 0.5 0.05
					}
				}
				# Post 1
				Transform {
					translation 0.0 0.5 0.05
					children [
						DEF Post Shape {
							appearance DEF Galvanized Appearance {
								material Material {
									ambientIntensity 0.3
									diffuseColor 0.3 0.3 0.3
									specularColor 0.7 0.7 0.8
									shininess 0.1
								}
							}
							geometry Cylinder {
								height 1.0
								radius 0.05
							}
						}
					]
				}
				# Post 2
				Transform {
					translation 4.95 0.5 0.05
					children USE Post
				}
			]
		}
		Transform {
			rotation 0 1 0  1.57
			children USE Fence
		}
		Transform {
			rotation 0 1 0  3.14159
			children USE Fence
		}
		Transform {
			rotation 0 1 0  -1.57
			children USE Fence
		}
	]
}

# Monkey Bars (demonstrates width [radius])

Transform {
	translation -4.0 0.0 0.0
	children [
		# Left Rear Post
		Transform {
			translation -0.3 1.0 -2.0
			children [
				DEF Lumber Shape {
					appearance DEF Wood Appearance {
						material Material {
							diffuseColor 0.8 0.6 0.4
						}
						texture ImageTexture {
							url "wood.jpg"
						}
					}
					geometry Box {
						size 0.1 2.0 0.1
					}
				}
			]
		}
		# Right Rear Post
		Transform {
			translation 0.3 1.0 -2.0
			children USE Lumber
		}
		# Left Front Post
		Transform {
			translation -0.3 1.0 2.0
			children USE Lumber
		}
		# Right Front Post
		Transform {
			translation 0.3 1.0 2.0
			children USE Lumber
		}

		# Rails & Rungs (Ladder)
		Transform {
			translation 0.0 1.8 0.0
			rotation 1.0 0.0 0.0  1.57
			children [
				DEF Ladder Group {
					children [
						# Left Rail
						Transform {
							translation -0.3 0.0 0.0
							children [
								DEF Pole Shape {
									appearance USE Galvanized
									geometry Cylinder {
										height 4.0
										radius 0.025
									}
								}
							]
						}
						# Right Rail
						Transform {
							translation 0.3 0.0 0.0
							children USE Pole
						}
						# Rung 0
						Transform {
							rotation 0.0 0.0 1.0  1.57
							scale 1.0 0.15 1.0
							children USE Pole
						}
						# Rung +
						Transform {
							translation 0.0 0.5 0.0
							rotation 0.0 0.0 1.0  1.57
							scale 1.0 0.15 1.0
							children USE Pole
						}
						# Rung -
						Transform {
							translation 0.0 -0.5 0.0
							rotation 0.0 0.0 1.0  1.57
							scale 1.0 0.15 1.0
							children USE Pole
						}
						# Rung +
						Transform {
							translation 0.0 1.0 0.0
							rotation 0.0 0.0 1.0  1.57
							scale 1.0 0.15 1.0
							children USE Pole
						}
						# Rung -
						Transform {
							translation 0.0 -1.0 0.0
							rotation 0.0 0.0 1.0  1.57
							scale 1.0 0.15 1.0
							children USE Pole
						}
						# Rung +
						Transform {
							translation 0.0 1.5 0.0
							rotation 0.0 0.0 1.0  1.57
							scale 1.0 0.15 1.0
							children USE Pole
						}
						# Rung -
						Transform {
							translation 0.0 -1.5 0.0
							rotation 0.0 0.0 1.0  1.57
							scale 1.0 0.15 1.0
							children USE Pole
						}
					]
				}
			]
		}
		# Monkey bars shadow
		Shape {
			appearance Appearance {
				material Material {
						diffuseColor 0.0 0.0 0.0
						transparency 0.5
				}
				texture ImageTexture { url "ladrshad.png" }
			}
			geometry IndexedFaceSet {
				coord Coordinate {
					point [
						-0.3  0.02  2.0,
						 0.3  0.02  2.0,
						 0.3  0.02 -2.0,
						-0.3  0.02 -2.0,
					]
				}
				coordIndex [ 0, 1, 2, 3 ]
				texCoord TextureCoordinate {
						point [
								0.0 0.0,
								1.0 0.0,
								1.0 1.0,
								0.0 1.0,
						]
				}
				texCoordIndex [ 0, 1, 2, 3 ]
				solid FALSE
			}
		}
	]
}

# Chin-Up Bars (demonstrates viewing height)

Transform {
	translation 0.0 0.0 -4.0
	children [
		# Left Post
		Transform {
			translation -2.0 0.5 0.0
			scale 1.0 0.5 1.0
			children USE Lumber
		}
		# Middle Post
		Transform {
			translation 0.0 1.0 0.0
			children USE Lumber
		}
		# Right Post
		Transform {
			translation 2.0 1.0 0.0
			children USE Lumber
		}
		# Left Bar
		Transform {
			translation -1.0 0.8 0.0
			rotation 0 0 1  1.57
			scale 1.0 0.5 1.0
			children USE Pole
		}
		# Right Bar
		Transform {
			translation 1.0 1.8 0.0
			rotation 0 0 1  1.57
			scale 1.0 0.5 1.0
			children USE Pole
		}
		# Chin-Up Bars shadow
		Shape {
			appearance Appearance {
				material Material {
						diffuseColor 0.0 0.0 0.0
						transparency 0.5
				}
			}
			geometry IndexedFaceSet {
				coord Coordinate {
					point [
						-2.0  0.02  0.05,
						 2.0  0.02  0.05,
						 2.0  0.02 -0.05,
						-2.0  0.02 -0.05,
					]
				}
				coordIndex [ 0, 1, 2, 3 ]
				texCoord TextureCoordinate {
						point [
								0.0 0.0,
								1.0 0.0,
								1.0 1.0,
								0.0 1.0,
						]
				}
				texCoordIndex [ 0, 1, 2, 3 ]
				solid FALSE
			}
		}
	]
}

# Slide (demonstrates step size)

Transform {
	translation 4.0 0.0 0.0
	children [
		# Supports
		Transform {
			translation -0.3 1.5 0.0
			scale 1.0 1.5 1.0
			children USE Lumber
		}
		Transform {
			translation 0.3 1.5 0.0
			scale 1.0 1.5 1.0
			children USE Lumber
		}
		# Ladder
		Transform {
			translation 0.0 1.4 1.4
			children [
				Transform {
					rotation 1.0 0.0 0.0  -0.7853975
					children [
						USE Ladder
					]
				}
			]
		}
		# Slide
		Transform {
			translation 0.0 2.8 0.0
			children [
				Shape {
					appearance USE Galvanized
					geometry Extrusion {
						beginCap FALSE
						endCap FALSE
						solid FALSE
						crossSection [
							-0.05  0.3,
							 0.05  0.3,
							 0.05 -0.3,
							-0.05 -0.3,
						]
						spine [
							0.0  0.0  0.0,
							0.0 -2.1 -3.0,
							0.0 -2.1 -3.5,
						]
					}
				}
			]
		}
		# Slide Bottom Support
		Transform {
			translation 0.3 0.35 -3.5
			scale 1.0 0.35 1.0
			children USE Lumber
		}
		# Slide Bottom Support
		Transform {
			translation -0.3 0.35 -3.5
			scale 1.0 0.35 1.0
			children USE Lumber
		}
		# Slide shadow
		Shape {
			appearance Appearance {
				material Material {
						diffuseColor 0.0 0.0 0.0
						transparency 0.5
				}
			}
			geometry IndexedFaceSet {
				coord Coordinate {
					point [
						-0.3  0.02  0.0,
						 0.3  0.02  0.0,
						 0.3  0.02 -3.5,
						-0.3  0.02 -3.5,
					]
				}
				coordIndex [ 0, 1, 2, 3 ]
				texCoord TextureCoordinate {
						point [
								0.0 0.0,
								1.0 0.0,
								1.0 1.0,
								0.0 1.0,
						]
				}
				texCoordIndex [ 0, 1, 2, 3 ]
				solid FALSE
			}
		}
		# Ladder shadow
		Shape {
			appearance Appearance {
				material Material {
						diffuseColor 0.0 0.0 0.0
						transparency 0.5
				}
				texture ImageTexture { url "ladrshad.png" }
			}
			geometry IndexedFaceSet {
				coord Coordinate {
					point [
						-0.3  0.02  2.8,
						 0.3  0.02  2.8,
						 0.3  0.02  0.0,
						-0.3  0.02  0.0,
					]
				}
				coordIndex [ 0, 1, 2, 3 ]
				texCoord TextureCoordinate {
						point [
								0.0 0.0,
								1.0 0.0,
								1.0 1.0,
								0.0 1.0,
						]
				}
				texCoordIndex [ 0, 1, 2, 3 ]
				solid FALSE
			}
		}
	]
}

# Swings (?)