XR/Unity3D
유니티 - 레이캐스팅 이용하기
디어솔
2018. 10. 14. 00:30
반응형
Vector3 incomingVec = hit.point - transform.position;
hit.point: the impact point in world space where the ray hit the collider.
Debug.DrawLine(transform.position, hit.point, Color.red); //ray
hit.normal: the normal of the surface the ray hit.
Debug.DrawRay(hit.point, hit.normal, Color.green); //wall surface normal
hit.distance //The distance from the ray's origin to the impact point.
Debug.DrawRay (transform.position, transform.forward * hit.distance, Color.blue);