i am not very good in raycast. can someone please help me to convert these line of code in 2D RaycastHit hit; if (Physics.Raycast(transform.position, direction, out hit, 100f)) { nextCollisionPosition = hit.point; Debug.Log(hit.collider.name); }
Why not just use Physics2D.Raycast and RaycastHit2D? Edit: Also, please do not spam threads. You don't need to ask the same question in multiple subforums.