// THIS IS WHERE I WILL ADD CODE TO MAKE GAZE INTREACTIONS
        private void Update()
        {
            if (!FindGazeTransform())
            {
                return;
            }

            if (DebugDrawRay)
            {
                // GazeOrigin is the HoloLens device, or my head
                // HitPosition is the closest object a ray from the HoloLens hits
                Debug.DrawRay(GazeOrigin, (HitPosition - GazeOrigin), Color.white);
                Debug.Log("My head is at position: " + GazeOrigin.ToString());
                Debug.Log("Object closest to me is at position: " + HitPosition.ToString());
            }

            // If I see the pink cube it should spin
            if (HitObject.transform.name == "SpinningCube")
            {
                HitObject.transform.GetComponent <CubeManager>().SpinCube();
                seenObjects.Add(HitObject.transform.name);
            }
            if (HitObject.transform.name != "SpinningCube")
            {
                HitObject.transform.GetComponent <CubeManager>().StopSpinCube();
            }

            // Homework: Detect the hidden object
        }
예제 #2
0
        public void UpdateBulletData(float time, ref WorldMovement Movement)
        {
            if (Movement != default)
            {
                Vector3 currentPos   = Movement.Position;
                Vector3 nextFramePos = Movement.Position + (Movement.MoveDirection * MuzzleVelocity * time);
                RayDistance = Vector3.Magnitude(nextFramePos - currentPos);

                if (RayDistance > 0)
                {
                    if (IsHit)
                    {
                        Movement.SetPosition(HitPosition);
                    }
                    else
                    {
                        NextFramePos = nextFramePos;
                        Movement.SetPosition(nextFramePos);
                    }
                }
                else
                {
                    "Log: Bullet is hit, position is ({0})".Log(HitPosition.ToString());
                }
            }
        }