Hi,
I have a main object that some other objects are toching that.now i want to send message to these objects form main object.
This is my code,but transform.collider.bounds.Intersects does not work correctly.main object send message to all of colliders not only to colliders that are touching it!
void OnCollisionEnter(Collision collision)
{
Collider[] colliders = Physics.OverlapSphere(myTransform.position, 0.5f);
foreach (Collider hit in colliders)
{
if (myTransform.collider.bounds.Intersects(hit.collider.bounds) && (hit.transform.tag == "Box")
{
hit.collider.transform.SendMessage("Change");
}
}
}