void Awake()
    {
        /* TODO: DEVELOPER CODING EXERCISE 3.a */

        // 3.a: GetComponent GazeStabilizer and assign it to gazeStabilizer.
        gazeStabilizer = GetComponent <GazeStabilizer>();
    }
    // Use this for initialization
    void Start()
    {
        child = transform.GetChild(0);
        childInitialPositions = child.localPosition;

        stabilizer = GameObject.Find("PreLoad").GetComponent <GazeStabilizer>();
    }
 // Use this for initialization
 void Start()
 {
     if (MenuRecorderPrefab == null || ParentPrefab == null)
     {
         Debug.Log("The prefab(-s) wasn't / weren't assigned in " + gameObject.name + ".");
     }
     MenuRecorderPrefab.SetActive(false);
     gazeStabilizer = this.gameObject.AddComponent <GazeStabilizer>();
     FocusedObject  = null;
 }
Exemple #4
0
    /// <summary>
    /// Calculates where a remote users's gaze cursor should be when a user is immersed
    /// </summary>
    void DrawRemoteGaze()
    {
        foreach (KeyValuePair <string, LevelPlayerStateData> players in systemIdToPlayerState)
        {
            if (players.Value.Immersed == false && players.Value.GazeIndicator != null)
            {
                int noShadowboxMask = (1 << 30) | (1 << 31);
                noShadowboxMask = ~noShadowboxMask;
                // this transform is in the original space, but the model has been scaled ImmersiveScale times.
                // need to cast a ray from this transform's pov in our scaled up space.
                //
                Transform      remotePlayerTransform = players.Value.FullAvatar.transform;
                GazeStabilizer gazeStab = players.Value.GazeIndicator.GetComponent <GazeStabilizer>();
                if (gazeStab == null)
                {
                    gazeStab = players.Value.GazeIndicator.AddComponent <GazeStabilizer>();
                }
                gazeStab.UpdateStability(remotePlayerTransform.position, remotePlayerTransform.rotation);

                Vector3 remotePlayerToModel = gazeStab.StablePosition - transform.position;
                Vector3 remoteGazeOrigin    = remotePlayerToModel * ImmersiveScale;


                Vector3    gazeTarget = remoteGazeOrigin + remotePlayerTransform.forward * ImmersiveScale * 2;
                Vector3    gazeNormal = Vector3.up;
                RaycastHit hitInfo;
                if (Physics.Raycast(remoteGazeOrigin, remotePlayerTransform.forward, out hitInfo, 1000.0f, noShadowboxMask))
                {
                    gazeTarget = hitInfo.point;
                    gazeNormal = hitInfo.normal;
                }

                players.Value.GazeIndicator.transform.position      = Vector3.Lerp(players.Value.GazeIndicator.transform.position, gazeTarget, 0.1f);
                players.Value.GazeIndicator.transform.localRotation = Quaternion.Slerp(players.Value.GazeIndicator.transform.localRotation, Quaternion.FromToRotation(Vector3.up, gazeNormal), 0.5f);

                if (players.Value.ImmersedAvatar != null)
                {
                    players.Value.ImmersedAvatar.transform.position = remoteGazeOrigin;
                    players.Value.ImmersedAvatar.transform.LookAt(gazeTarget);
                }
                else
                {
                    Debug.Log("No immersed avatar...");
                }
#if LINE_REND
                Vector3[] points = new Vector3[] { remoteGazeOrigin, gazeTarget };
                lineRend.SetPositions(points);
#endif
            }
        }
    }
Exemple #5
0
    void Awake()
    {
        gazeStabilizer = GetComponent <GazeStabilizer>();

        Instance           = this;
        recognizer         = new GestureRecognizer();
        recognizer.Tapped += (args) => {
            // Send an OnSelect message to the focused object and its ancestors.
            if (FocusedObject != null)
            {
                FocusedObject.SendMessageUpwards("OnSelect", SendMessageOptions.DontRequireReceiver);
            }
        };
        recognizer.StartCapturingGestures();
    }
Exemple #6
0
        private void GenerateSubmesh(Mesh m, string i)
        {
            GameObject     go   = new GameObject("ParentPrefab" + i.Substring(0, 10));
            GazeStabilizer stab = go.AddComponent <GazeStabilizer>();
            MeshFilter     mf   = go.AddComponent <MeshFilter>();

            //BoxCollider bc = go.AddComponent<BoxCollider>();
            //bc.center = Vector3.zero;
            go.transform.SetParent(MeshHolder.transform, false);
            MeshRenderer mr = go.AddComponent <MeshRenderer>();

            mr.material = MeshMaterial;
            mr.allowOcclusionWhenDynamic = true;
            mr.receiveShadows            = true;
            mf.mesh = m;
        }
Exemple #7
0
    // Use this for initialization
    void Start()
    {
        gazeStabilizer = GetComponent <GazeStabilizer>();

        // Initialize the miniature figure
        if (MiniaturePrefab == null)
        {
            Miniature = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            Miniature.transform.localScale = new Vector3(0.01f, 0.01f, 0.01f);
        }
        else
        {
            Miniature = Instantiate(MiniaturePrefab) as GameObject;
        }
        Miniature.transform.parent   = gameObject.transform;
        Miniature.name               = "Miniature";
        Miniature.transform.position = new Vector3(0, 0, DrawDistance);
    }
Exemple #8
0
 void Awake()
 {
     Instance = this;
     // GetComponent GazeStabilizer and assign it to gazeStabilizer.
     gazeStabilizer = GetComponent <GazeStabilizer>();
 }
Exemple #9
0
        private async void Update_MeshAsync()
        {
            if (_infoUpdated)
            {
                _infoUpdated = false;
                StringBuilder builder = new StringBuilder();
                builder.AppendLine($"Floor Area         {meshInfo.HorizSurfaceArea}m\xB2");
                builder.AppendLine($"Wall Area          {meshInfo.WallSurfaceArea}m\xB2");
                builder.AppendLine($"Ceiling Area       {meshInfo.VirtualCeilingSurfaceArea}m\xB2");
                builder.AppendLine($"Total Surface Area {meshInfo.TotalSurfaceArea}m\xB2");
                Debug.Log(builder.ToString());
                meshInfoText.text = builder.ToString();
            }
            if (_filechanged)
            {
                _filechanged = false;
                DebugDialog.Instance.PrimaryText = "Generating Mesh...";
                testMeshList.Clear();
                meshInfoText.text = string.Empty;
                Component[] previous = MeshHolder.GetComponentsInChildren <MeshRenderer>();
                foreach (Component comp in previous)
                {
                    //Debug.Log("Destroying..." + comp.name);
                    Destroy(comp.gameObject);
                }
                List <string> meshStringList = SplitMesh(Filename);
                //                const string V = @"o Cube
                //v 1.000000 -1.000000 -1.000000
                //v 1.000000 -1.000000 1.000000
                //v -1.000000 -1.000000 1.000000
                //v -1.000000 -1.000000 -1.000000
                //v 1.000000 1.000000 -1.000000
                //v 0.999999 1.000000 1.000001
                //v -1.000000 1.000000 1.000000
                //v -1.000000 1.000000 -1.000000
                //vt 2.094305 1.396205
                //vt 1.396205 2.094305
                //vt 0.698100 1.396205
                //vt 1.396205 0.698100
                //vt 5.000000 5.000000
                //vt 2.792410 5.000000
                //vt 2.792410 2.792410
                //vt 5.000000 2.792410
                //vt 2.792410 2.094305
                //vt 2.094305 2.792410
                //vt 0.698100 2.792410
                //vt 0.000000 2.094305
                //vt 0.000000 0.698100
                //vt 0.698100 0.000000
                //vt 2.792410 0.698100
                //vt 2.094305 0.000000
                //f 1/1/1 2/2/2 3/3/3
                //f 1/1/1 3/3/3 4/4/4
                //f 5/5/5 8/8/6 7/7/7
                //f 5/5/5 7/7/7 6/6/8
                //f 1/1/1 5/5/9 6/6/10
                //f 1/1/1 6/6/10 2/2/2
                //f 2/2/2 6/6/11 7/7/12
                //f 2/2/2 7/7/12 3/3/3
                //f 3/3/3 7/7/13 8/8/14
                //f 3/3/3 8/8/14 4/4/4
                //f 5/5/15 1/1/1 4/4/4
                //f 5/5/15 4/4/4 8/8/16";
                //                List<string> meshStringList = new List<string>();
                //                meshStringList.Add(V) ;

                meshStringList.ForEach(i =>
                {
                    StartCoroutine(BuildSubmesh(i));
                });
                Debug.Log("Parent Generated");
                GazeStabilizer stabalizer = MeshHolder.AddComponent <GazeStabilizer>();
                DebugDialog.Instance.ClearText();
                Debug.Log("Mesh List" + testMeshList.Count);
                string t = await MeshSaver.SaveAsObjAsync("test_mesh_out", testMeshList);

                Debug.Log(t);
            }
        }
Exemple #10
0
 void Awake()
 {
     gazeStabilizer = GetComponent <GazeStabilizer>();
     cursor         = GetComponent <Cursor>();
 }
Exemple #11
0
 void Awake()
 {
     // GetComponent GazeStabilizer and assign it to gazeStabilizer.
     gazeStabilizer = GetComponent <GazeStabilizer>();
 }
Exemple #12
0
 // Use this for initialization
 void Start()
 {
     gazeStabilier = this.gameObject.AddComponent <GazeStabilizer>();
 }