<?xml version="1.0" ?>
<scene AmbientColor="0.7,0.7,0.7"
	FullName="Demo: Hold and go"
	formatVersion="1.0">
	<BoundingBox MaxCorner="140.088,93.5902,20"
		MinCorner="-177.325,-88.8772,-20"
		Name="Boundaries">
		<Mesh Mesh="Boundary"
			Name="ForceFieldAccuracy/Boundary"
			Position="0, 0, 0"
			Rotation="0,0,0"
			Scale="5, 5, 5" />
	</BoundingBox>
	<ForceFieldVisualization TimeToLive="10,20">
		<Trail HeadHeight="5"
			HeadMaterial="ForceFieldAccuracy/LightRibbonTrailHead"
			HeadWidth="5"
			Material="ForceFieldAccuracy/LightRibbonTrail"
			MaxElements="20"
			NumberOfChains="1"
			TrailLength="50"
			UseColours="true"
			UseTextureCoords="true">
			<Chain ColorChange="0.1, 0.1, 0.1, 0.1"
				Index="0"
				InitialColor="1.0, 0.8, 0"
				InitialWidth="4"
				WidthChange="0.5" />
		</Trail>
	</ForceFieldVisualization>
	<GroundLevel Value="300" />
	<Preset>
		<Camera Pos="-17.1417,8.2155,331.64"
			Type="camera_script1" />
		<Jumper Create="1"
			Position="-156.194,14.1187,0" />
		<Wind Enabled="true">
			<Region>
				<Description>Creates wind in a given direction.

Use Radius1 to set the direction and strength of the wind.
No change with the time</Description>
				<Function>-- CONSTANT_FUNCTION --
function CalculateForce()
  -- Strength of the field depends on the Radius1
  return -CVector.UNIT_X * Radius1 * 0.3;
end
function Update()
	-- Does not return anything
end</Function>
				<Radius Name="1"
					Position="-104.137,-8.25791,0">Direction and strength of the wind</Radius>
				<Radius Name="2"
					Position="-94.789,-9.72904,0">Not used</Radius>
				<Radius Name="3"
					Position="-89.789,-14.729,0">Not used</Radius>
				<Shape Orientation="1,0,0,0"
					Position="-89.789,-9.72904,0"
					Size="67.6891,64.7504,20" />
			</Region>
			<Region>
				<Description>Creates wind in a given direction.

Use Radius1 to set the direction and strength of the wind.

Center is moving from Radius2 to Radius3 and back.</Description>
				<Function>function CalculateForce()
  -- Get distance from the center of the field in X direction
  Distance =  math.abs(Pos.x - FieldCenter.x);
  if(Distance &gt; 15)then return CVector.ZERO; end;
  -- Strength of the field depends on the Radius1
  return CVector.UNIT_Y * Radius1 * 0.3;
end

-- Speed of the movement m/s
MovementSpeed = 20;
-- Distance to move
DistanceToMove = Radius3Pos.x - Radius2Pos.x;
-- Movement progress from start to finish
Progress = 0;
-- Flag indicating movement back to Radius2
BackMovement = false;
function Update()
  -- Calculate progress step
  ProgressStep = (MovementSpeed * DeltaTime) / math.abs(DistanceToMove);
  if(Progress &gt;= 1)then BackMovement = true; Progress = 1; end;
  if(Progress &lt;= 0)then BackMovement = false; Progress = 0; end;
  if(BackMovement)then ProgressStep = -ProgressStep; end;
  -- Increase progress
  Progress = Progress + ProgressStep;
  -- Set new field center
  FieldCenter.x = DistanceToMove * Progress + Radius2Pos.x;
end</Function>
				<Radius Name="1"
					Position="16.8983,38.4628,0">Direction and strength of the wind</Radius>
				<Radius Name="2"
					Position="-56.7806,1.23201,0">Start moving position</Radius>
				<Radius Name="3"
					Position="94.3468,-0.8613,0">Finish moving position</Radius>
				<Shape Orientation="1,0,0,0"
					Position="18.3661,3.35751,0"
					Size="152.854,188.463,20" />
			</Region>
		</Wind>
	</Preset>
	<SkyBox Distance="5000"
		Material="ForceFieldAccuracy/SkyBox/CloudySky" />
	<Stream File="../data/sounds/wind.mp3"
		Loop="true"
		Name="BgMusic" />
	<Target File="../data/ForceFieldAccuracy/models/PortalTarget.phs"
		Material="Target"
		Name="Target"
		Orientation="1, 0, 0, 0"
		Position="123.764,-0.674179,0" />
</scene>
