Answer the question
In order to leave comments, you need to log in
Why does a 2d ray only react to itself? Do not touch other objects?
private void Update()
{
//Ray2D jumpRay = new Ray2D(transform.position, transform.right);
RaycastHit2D hit;
hit = Physics2D.Raycast(transform.position, transform.right, 10f);
//Debug.DrawRay(transform.position, transform.right, Color.yellow);
if (hit.collider != null)
{
Debug.Log(hit.transform.gameObject.name);
}
}
Answer the question
In order to leave comments, you need to log in
Well, you let him out of yourself, so he will meet his collider first, and only then another, but of course it doesn’t matter anymore, it returns the first one.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question