Out() 공개 메소드

public Out ( ) : void
리턴 void
예제 #1
0
파일: VrPointer.cs 프로젝트: Eli-P/VR_AR
        void Raycast()
        {
            RaycastHit target;

            // we found an object
            if (Physics.Raycast(origin.position, transform.forward, out target, maxDistance, detectedLayers.value))
            {
                Target = target;

                EndPosition = target.point;

                currInteractable = target.collider.transform.GetComponent <Interactable>();

                // call selection method
                if (currInteractable)
                {
                    currInteractable.Over();
                }
            }

            // we didn't find any object
            else
            {
                Target = new RaycastHit();

                EndPosition = transform.position + transform.forward * maxDistance;

                // call the unselection method
                if (currInteractable)
                {
                    currInteractable.Out();
                }
            }

            // check that selection changed
            if (currInteractable != prevInteractable)
            {
                prevInteractable?.Out();
            }

            prevInteractable = currInteractable;

            if (true)
            {
                Debug.DrawRay(transform.position, EndPosition - transform.position, Color.blue);
            }
        }
예제 #2
0
        void RayCast()
        {
            RaycastHit target;

            //found an object
            if (Physics.Raycast(transform.position, transform.forward, out target, maxDistance))
            {
                EndPosition      = target.point;
                currInteractable = target.transform.GetComponent <Interactable>();

                //call selection method
                if (currInteractable)
                {
                    currInteractable.Over();
                }
            }

            //no object found
            else
            {
                EndPosition = transform.position + transform.forward * maxDistance;
                //call unselection method
                if (currInteractable)
                {
                    currInteractable.Out();
                }
            }

            //check that selection chagned at all
            if (currInteractable != prevInteractable)
            {
                prevInteractable?.Out();
            }
            prevInteractable = currInteractable;

            if (showRay)
            {
                Debug.DrawRay(transform.position, EndPosition - transform.position, Color.blue);
            }
        }