void FreeCamera::Update()
{
    float deltaT = 0.01f;
    static GLfloat ACCELERATION = 2.0f;

    if(GlobalVar::keys[GLFW_KEY_RIGHT_CONTROL])
        deltaT *= ACCELERATION;
    /* Camera movment*/
    if(GlobalVar::keys[GLFW_KEY_W]) MoveForward(deltaT);
    if(GlobalVar::keys[GLFW_KEY_S]) MoveForward(-deltaT);

    if(GlobalVar::keys[GLFW_KEY_A]) MoveRight(-deltaT);
    if(GlobalVar::keys[GLFW_KEY_D]) MoveRight(deltaT);

    if(GlobalVar::keys[GLFW_KEY_R]) MoveLift(deltaT);
    if(GlobalVar::keys[GLFW_KEY_F]) MoveLift(-deltaT);

    // Rotate camera
    if(GlobalVar::keys[GLFW_MOUSE_BUTTON_LEFT]){
        // Retrieve cursor current position
        GLdouble newposX, newposY;
        glfwGetCursorPos(GlobalVar::glfwWindow, &newposX, &newposY);

        static GLfloat Rx=0.0f, Ry=0.0f;
        static GLfloat MOUSESENSITIVTY =  0.1f;
        Rx = (GLfloat)(GlobalVar::dCursorRestpos[0] - newposX) * MOUSESENSITIVTY;
        Ry = (GLfloat)(newposY - GlobalVar::dCursorRestpos[1]) * MOUSESENSITIVTY;
        Rotate(Rx, Ry, 0);

        // Save last cursor position
        GlobalVar::dCursorRestpos[0] = newposX;
        GlobalVar::dCursorRestpos[1] = newposY;
    }
}
task main()
{
	waitForStart();

	wait1Msec(1450);

	MotorEncoderTarget(2, 11, 11, 65, 10);

	if (SensorValue[IRSeeker] > 2)
	{
		MotorEncoderTarget(2, 20, 20, 65, 10);

		Temp1++;

		if (SensorValue[IRSeeker] > 2)
		{
			MotorEncoderTarget(2, 21, 21, 65, 10);

			Temp1++;
		}

	}
	wait10Msec(20);

	MotorEncoderTarget(1, -2100, 2100, 60, 30);
	//MotorEncoderTarget(1, (-2000 + Temp1*50), (1950 - Temp1*50), 60, 30);

	if(Temp1 == 1)
	{
		MoveLift(1, 3000, 30);
	}
	else
	{
		MoveLift(1, 600, 30);
	}

	MotorEncoderTarget(2, 30, 30, 70, 30);
	LineCheck(7 * 115);
	motor[motorL] = 0;
	motor[motorR] = 0;

	if(Temp1 == 1)
	{
		MoveLift(2, 1200, 30);
	}
	else
	{
		MoveLift(2, 550, 30);
	}

	MotorEncoderTarget(2, -36, -36, 80, 10);

	MotorEncoderTarget(1, 2100, -2100, 80, 10);

	switch (Temp1)
	{
		case 0:
			MotorEncoderTarget(2, -10, -10, 80, 10);
			break;
		case 1:
			MotorEncoderTarget(2, -30, -30, 80, 10);
			break;
		case 2:
			MotorEncoderTarget(2, -55, -55, 80, 10);
			break;
	}

}