예제 #1
0
파일: RayPointer.cs 프로젝트: cwp10/vr-core
    private void UpdateRaycast()
    {
        Ray        ray = new Ray(transform.position, transform.forward);
        RaycastHit hit;

        bool bHit = Physics.Raycast(ray, out hit);

        if (_previousTarget && _previousTarget != hit.transform)
        {
            RayPointEventArgs argsOut = new RayPointEventArgs();
            argsOut.distance = 0;
            argsOut.device   = device_;
            argsOut.target   = _previousTarget;
            OnPointOut(argsOut);
            _previousTarget = null;
        }

        if (bHit && _previousTarget != hit.transform)
        {
            RayPointEventArgs argsIn = new RayPointEventArgs();
            argsIn.distance = hit.distance;
            argsIn.device   = device_;
            argsIn.target   = hit.transform;
            OnPointIn(argsIn);
            _previousTarget = hit.transform;
        }

        if (!bHit)
        {
            _previousTarget = null;
        }
    }
예제 #2
0
파일: VRPlayer.cs 프로젝트: cwp10/vr-core
 private void OnPointerOut(object sender, RayPointEventArgs e)
 {
     rayPointOut?.Invoke(e);
 }
예제 #3
0
파일: VRPlayer.cs 프로젝트: cwp10/vr-core
 private void OnPointerIn(object sender, RayPointEventArgs e)
 {
     rayPointIn?.Invoke(e);
 }
예제 #4
0
파일: RayPointer.cs 프로젝트: cwp10/vr-core
 public void OnPointOut(RayPointEventArgs e)
 {
     pointerOut?.Invoke(this, e);
 }
예제 #5
0
파일: RayPointer.cs 프로젝트: cwp10/vr-core
 public void OnPointIn(RayPointEventArgs e)
 {
     pointerIn?.Invoke(this, e);
 }