示例#1
0
 // Update is called once per frame
 void NewParticipantListener()
 {
     participantID.text = ps.GetParticipantAsString();
     ps.ConditionFromParticipant();
     ParticipantStatus.Condition cond = ps.GetCondition();
     cubeset.text     = cond.cubeset.ToString();
     arrangement.text = cond.catmap.ToString();
 }
示例#2
0
 void PreviousParticipantListener()
 {
     if (ps.GetParticipant() > 0)
     {
         participantID.text = ps.GetParticipantAsString();
         ParticipantStatus.Condition cond = ps.GetCondition();
         cubeset.text     = cond.cubeset.ToString();
         arrangement.text = cond.catmap.ToString();
     }
 }
    // Update is called once per frame
    public void Update()
    {
        GameObject cube = GameObject.FindGameObjectWithTag("Interactable Object");

        if (player != null && cube != null)
        {
            if (cube != null)
            {
                Transform transform = cube.GetComponent <Transform>();
                int[]     angles    =
                {
                    (int)Math.Abs(Math.Round(Vector3.Angle(player.transform.forward, transform.right)) - 90.0),
                    (int)Math.Abs(Math.Round(Vector3.Angle(player.transform.forward, transform.up)) - 90.0),
                    (int)Math.Abs(Math.Round(Vector3.Angle(player.transform.forward, transform.forward)) - 90.0),
                };
                int max         = angles.Max();
                int visibleSide = NOSIDE;
                // basic idea: is the cube face angled towards us enough for us to see it?
                // we also want to check if the player's head is rotated up or to the side too far
                if (max > thresholdAngle)
                {
                    visibleSide = angles.ToList().IndexOf(max);
                }

                bool publishUpdate = false;

                if (ps.GetTrial() != trial)
                {
                    trial         = ps.GetTrial();
                    publishUpdate = true;
                }
                else
                {
                    if (visibleSide != previousSide)
                    {
                        publishUpdate = true;
                    }
                }

                if (publishUpdate)
                {
                    // the last Vector3 is a placeholder for the cumulative movement of the head and hand controllers
                    DataFarmer.GetInstance().Save(
                        new DFFixation(
                            "up=" + angles[UP],
                            "forward=" + angles[FORWARD],
                            "right=" + angles[RIGHT],
                            dirStrings[visibleSide],
                            ps.DisplacementsToString()
                            )
                        );
                    previousSide = visibleSide;
                }

                if (detailedLogging && measurements % 20 == 0)
                {
                    angleDisplay.text =
                        "participant " + ps.GetParticipantAsString()
                        + " condition " + ps.GetCondition().ToString() + "\n"
                        + "right " + player.transform.forward[RIGHT]
                        + " up " + player.transform.forward[UP]
                        + "\n" + dirStrings[UP] + " " + angles[UP]
                        + ", " + dirStrings[RIGHT] + " " + angles[RIGHT]
                        + ", " + dirStrings[FORWARD] + " " + angles[FORWARD]
                        + "\n" + dirStrings[visibleSide] + " is facing you"
                        + "\n" + "correct answer is " + ps.GetCategory();
                }
                ;
                measurements++;
            }
        }
    }