OvrEyeRay.cs 618 B

12345678910111213141516171819202122
  1. using System;
  2. using UnityEngine;
  3. public class OvrEyeRay : MonoBehaviour
  4. {
  5. public Ray GetRay()
  6. {
  7. this.m_ray.origin = base.transform.position;
  8. this.m_ray.direction = base.transform.forward;
  9. return this.m_ray;
  10. }
  11. public bool RayCast(out RaycastHit f_hitInfo, float f_maxDistance, int f_layerMask)
  12. {
  13. this.m_ray.origin = base.transform.position;
  14. this.m_ray.direction = base.transform.forward;
  15. Debug.DrawLine(this.m_ray.origin, this.m_ray.direction * f_maxDistance, Color.yellow);
  16. return Physics.Raycast(this.m_ray, out f_hitInfo, f_maxDistance, f_layerMask);
  17. }
  18. private Ray m_ray = default(Ray);
  19. }