Hi,how can i make line renderer detects collisions on its way (Player) and when collision is detected then print(“player detected”)
I think you’re looking for something like this (C#)…
RaycastHit hit;
if (Physics.Raycast (lineStartPosition, lineEndPosition - lineStartPosition, out hit)) {
switch(hit.transform.gameObject.tag)
{
case "Player":
//Output message
print("player detected");
break;
}
}
You may need to Raycast each line segment yourself. I hope there is a better answer