www.pudn.com > vrmlExample.rar > ROUTE.WRL


#VRML V2.0 utf8 
 
Viewpoint 
{ 
	position 0 0 15 
	orientation 0 0 1 0 
	fieldOfView 0.8 
} 
 
Background 
{ 
	skyColor		 
	[	0 	0 	0.2, 
		0.1 	0.1 	0.8, 
		0.7 	0.8 	0.9 
	] 
	 
	skyAngle 	[1 	1.57] 
 
	groundColor 	 
	[	0.0 	0.0 	0.0, 
		0.5 	0.4 	0.3, 
		0.3 	0.3 	0.3 
	] 
 
	groundAngle 	[1	1.57] 
} 
 
DEF ball Transform 
{ 
	children 
	[ 
		DEF switch TouchSensor 
		{ 
		} 
 
		Shape 
		{ 
			appearance Appearance 
			{ 
				material  Material 
				{  
					diffuseColor 1,0,0 
					emissiveColor 0.0 0.0 0.0 
					shininess 0.2 
					specularColor 0.0 0.0 0.0 
					transparency 0.0 
				} 
				texture NULL 
				textureTransform NULL 
			} 
			geometry Sphere{} 
		} 
	] 
} 
 
 
DEF Time TimeSensor 
{  
	cycleInterval 5  
	loop TRUE 
} 
 
 
DEF position PositionInterpolator 
{ 
	key [0 1] 
	keyValue   
	[ 
		-10 0 0, 
		10 0 0 
	] 
} 
 
DEF position2 PositionInterpolator 
{ 
	key [0 0.5 1] 
	keyValue   
	[ 
		-10 0 0, 
		0  2  10, 
		10 0 0 
	] 
} 
 
DEF changePath Script 
{ 
	url "route.class" 
  	field SFBool status FALSE	 
	field SFNode position  USE position 
	field SFNode position2 USE position2 
	field SFNode ball      USE ball 
	eventIn	SFBool	onChange 
} 
 
ROUTE Time.fraction_changed   TO  position.set_fraction 
ROUTE Time.fraction_changed   TO  position2.set_fraction 
#ROUTE position.value_changed  TO  ball.translation 
ROUTE switch.isActive  TO changePath.onChange