Axiom.Demos.Water.AnimateHead C# (CSharp) Method

AnimateHead() public method

public AnimateHead ( float timeSinceLastFrame ) : void
timeSinceLastFrame float
return void
		public void AnimateHead( float timeSinceLastFrame )
		{
			//animState.AddTime(timeSinceLastFrame);

			for ( int i = 0; i < 4; i++ )
			{
				sines[ i ] += adds[ i ] * headSpeed * timeSinceLastFrame;
			}
			float tx = (float)( ( System.Math.Sin( sines[ 0 ] ) + System.Math.Sin( sines[ 1 ] ) ) / 4 + 0.5 ) * (float)( CMPLX - 2 ) + 1;
			float ty = (float)( ( System.Math.Sin( sines[ 2 ] ) + System.Math.Sin( sines[ 3 ] ) ) / 4 + 0.5 ) * (float)( CMPLX - 2 ) + 1;

			// Push water down beneath the Ogre Head
			waterMesh.Push( tx, ty, headDepth, 150f, headSpeed, false );

			float step = PLANE_SIZE / CMPLX;
			headNode.ResetToInitialState();

			Vector3 newPos = new Vector3( step * tx, 80f - 40f * headDepth, step * ty );
			Vector3 diffPos = newPos - oldPos;
			Quaternion headRotation = Vector3.UnitZ.GetRotationTo( diffPos );
			oldPos = newPos;
			headNode.ScaleBy( new Vector3( 3.0f, 3.0f, 3.0f ) );
			headNode.Translate( newPos );
			headNode.Rotate( headRotation );
		}