I have a GameObject
with a box collider and a DetectRaycasts
script attached to it.
I want a Function Like This (CheckAnyRaycastIntersection()
):
using UnityEngine;
public class DetectRaycasts : MonoBehaviour
{
[SerializeField] BoxCollider bxCollider;
void Update()
{
bool i = bxCollider.CheckAnyRaycastIntersection();
print(i); //Prints TRUE if any Raycast intersects with bxCollider
//Otherwise prints FALSE
}
}
CodePudding user response:
I don't understand why you want to do this,
If you want to see gameObject colliding with something else, use the spherecast or boxcast.
In this scenario you should explain who is throwing raycast and who should or should not intersect with the ray.
If you can explain more, i can help.
CodePudding user response: