회전시키면서 레이저를 쏘는 공격 패턴을 만들고 있는데,
오브젝트를 회전시키면서 ray를 쏴서 체크하는데 특정 각도에 도달하면 레이가 체크 안되는 문제가 발생합니다.
제가 사용하고 있는 코드입니다.
var t = timeCount / rotatingTime;
transform.rotation = Quaternion.Lerp(startRotation, targetRotation, t);
var hit = Physics2D.Raycast(originPos, transform.right, Length, hitLayer);
if (hit)
{
Length = Vector2.Distance(hit.point, originPos);
}
else
{
Length = maxLength;
}
파란 경우 : 정상작동 , 빨간 경우 : 오류
혹시 이에 대한 해결방안이나, 다른 구현 방법을 알려주실수 있을까요?
Debug.DrawRay 찍어봐 Length 문제 아닐까 싶은데
저 빨강, 파랑 선이 drawray로 그린 결과값이라 그문제는 아닙니다 ㅜㅜ