Beispiel #1
0
    private void Update()
    {
        if (Stage == SpatialTaskStage.Question)
        {
            timer += Time.deltaTime;

            if (InputManager.GetSpatialConfirmButton())
            {
                // calculate error
                Transform controller  = ExperimentManager.ControllerStick;
                Vector3   pointing    = controller.forward;
                Vector3   groundTruth = startPos - ExperimentManager.PlayerController.position;

                angleError        = Vector3.Angle(pointing, groundTruth);
                angleErrorOnPlane = Vector3.Angle(new Vector3(pointing.x, 0, pointing.z), new Vector3(groundTruth.x, 0, groundTruth.z));

                taskPosition        = startPos.ToString();
                playerPosition      = ExperimentManager.PlayerController.position.ToString();
                controllerDirection = pointing.ToString();

                Stage = SpatialTaskStage.Closed;
                bool result = SpatialTaskManager.FinishTask(TaskIndex);
                if (!result)
                {
                }
            }
        }
    }
Beispiel #2
0
 private void OnTriggerEnter(Collider other)
 {
     if (Stage == SpatialTaskStage.Waiting)
     {
         if (other.gameObject.tag == "Hand" && gameObject.tag != "Hand")
         {
             Stage = SpatialTaskStage.Discovered;
         }
     }
     else if (Stage == SpatialTaskStage.Discovered)
     {
         // to invoke question stage
         if (other.gameObject.tag == "Hand" && gameObject.tag != "Hand")
         {
             Stage = SpatialTaskStage.Question;
         }
     }
 }