// Start is called before the first frame update void Start() { handCursorController = GameObject.FindGameObjectWithTag("Cursor").GetComponent <HandCursorController>(); experimentController = handCursorController.experimentController; // find the tracker object cursObjTracker = GameObject.FindGameObjectWithTag("CursObjTracker"); }
void Awake() { // get the inputs we need for displaying the cursor handCursor = GameObject.FindGameObjectWithTag("Cursor"); cursObjTracker = GameObject.FindGameObjectWithTag("CursObjTracker"); handCursorController = handCursor.GetComponent <HandCursorController>(); experimentController = handCursorController.experimentController; targetContainerController = experimentController.targetContainerController; }
private void Awake() { targetDistance = 0.1f; oldArc = arcSpan; prevWidth = width; prevSpan = arcSpan; prevThickness = thickness; GenerateArc(); // get the inputs we need for displaying the cursor handCursor = GameObject.FindGameObjectWithTag("Cursor"); handCursorController = handCursor.GetComponent <HandCursorController>(); experimentController = handCursorController.experimentController; targetContainerController = experimentController.targetContainerController; }
// Start is called before the first frame update void Start() { //initialize variables and data structures handCursor = GameObject.FindGameObjectWithTag("Cursor"); home = GameObject.FindGameObjectWithTag("Home"); experimentController = GameObject.FindGameObjectWithTag("ExpCont").GetComponent <ExperimentController>(); handCursorController = handCursor.GetComponent <HandCursorController>(); prevPosition = handCursor.transform.localPosition; currPosition = Vector3.zero; prevTime = 0; handVelocity = Vector3.zero; velocityHistory = new Stack <Vector3>(); // find the tracker object cursObjTracker = GameObject.FindGameObjectWithTag("CursObjTracker"); }
private void Start() { text = GetComponent <TextMeshPro>(); cntrler = hand.GetComponent <HandCursorController>(); }
// end session or begin next trial (This should ideally be called via event system) // destroys the the current target and starts next trial public void EndAndPrepare() { session.CurrentTrial.result["home_x"] = homeCursor.transform.position.x; session.CurrentTrial.result["home_y"] = homeCursor.transform.position.y; session.CurrentTrial.result["home_z"] = homeCursor.transform.position.z; session.CurrentTrial.result["step_time"] = stepTime; session.CurrentTrial.result["obj_shape"] = objShape; session.CurrentTrial.result["distractor_loc"] = distractorLoc; session.CurrentTrial.result["obj_spawn_x"] = objSpawnX; session.CurrentTrial.result["obj_spawn_z"] = objSpawnZ; session.CurrentTrial.result["recepticle_x"] = recepticleX; session.CurrentTrial.result["recepticle_y"] = recepticleY; session.CurrentTrial.result["recepticle_z"] = recepticleZ; session.CurrentTrial.result["target_x"] = targetX; session.CurrentTrial.result["target_y"] = targetY; session.CurrentTrial.result["target_z"] = targetZ; session.CurrentTrial.result["loc_x"] = locX; session.CurrentTrial.result["loc_y"] = locY; session.CurrentTrial.result["loc_z"] = locZ; //Debug.Log("ending reach trial..."); // destroy the target, spawn home? targetContainerController.DestroyTargets(); if (GameObject.Find("RayPositionCursor") != null) { positionLocCursorController.Deactivate(); } // Reassign the hand controlling the cursor as well as the virtual 3D hand model HandCursorController cursorCntrler = handCursor.GetComponent <HandCursorController>(); SkinnedMeshRenderer rightHandRender = RightHandRenderer.GetComponent <SkinnedMeshRenderer>(); SkinnedMeshRenderer leftHandRender = LeftHandRenderer.GetComponent <SkinnedMeshRenderer>(); bool rightHanded = false; try { rightHanded = session.NextTrial.settings.GetString("hand") == "r"; } catch (NoSuchTrialException) { // If we are at the end of a block, this will grab the first trial of the next block try { rightHanded = session.GetBlock(session.currentBlockNum + 1).firstTrial.settings.GetString("hand") == "r"; Debug.Log("Reached end of block. Starting next block."); } catch (System.ArgumentOutOfRangeException) { Debug.Log("Reached end of experiment"); } } Debug.Log("Reassigning hand for next trial. Righthanded: " + rightHanded); // Assign the Oculus controller m_controller = rightHanded ? OVRInput.Controller.RTouch : OVRInput.Controller.LTouch; // Assign the virtual hand model //if (!cursorCntrler.holdingItem && !cursorCntrler.taskCompleted) //{ // rightHandRender.enabled = rightHanded; // leftHandRender.enabled = !rightHanded; //} //else { rightHandRender.enabled = leftHandRender.enabled = false; } // Assign the cursor cursorCntrler.HandForNextTrial = rightHanded ? "r" : "l"; cursorCntrler.ChangeHand(rightHanded ? RightControllerAnchor : LeftControllerAnchor); // Vibrate the controller to let the participant know which hand to use if (session.CurrentTrial.settings.GetString("experiment_mode") != "target") { cursorCntrler.ShortVibrateController(1.0f, 0.5f); } else { cursorCntrler.visible = false; } // Make home cursor appear (at dock for next trial) homeCursorController.Appear(); // end the current trial in UXF if (session.CurrentTrial.number == session.LastTrial.number) { session.End(); } else { session.CurrentTrial.End(); } }