RayCast not working , why ???
The green line in image is the debug of the ray cast that I'm working but the collision not is detect to rigidbody/box collider on player
if (alvo == null)
{
Ray ray = new Ray(origemRadar.position, origemRadar.forward);
RaycastHit hit;
if (Physics.Raycast(ray, out hit))
{
if (hit.collider.CompareTag("Player"))
{
alvo = hit.collider.gameObject;
}
}
Debug.DrawRay(ray.origin, transform.forward, Color.green);
}
Comment
Your answer
Follow this Question
Related Questions
how to prevent a kinematic rigidbody from going through static colliders 0 Answers
How to raycast object as far as possible, without collision? 0 Answers
Raycast collision vs unity collision system ( 2D Android game). 1 Answer
Physics.Raycast() always returns false 1 Answer
Collider fires consistently, but Trigger does not? 0 Answers