Hi everyone,
I am trying to detect the collision between two object. Basically there are 5 spheres that will collide whit a slightly moving object. First the first sphere, than I will put the gravity to the second one and so on. Everytime I destroy the collided sphere. In the last sphere I reset the scene. I print “collision detected (name_of_the_sphere)” everytime that the collision happens. The problem is that sometimes is really random. In particular the collision detected sometimes appear twice for some sphere, sometimes only once, then 2 times…how is it possible?
ps: the object on which the spheres impact is kinematic
void OnCollisionEnter(Collision col)
{
print("Collisione center");
GameObject altodx = GameObject.Find("altodx");
Rigidbody rb = altodx.GetComponent<Rigidbody>();
rb.useGravity = true;
//play the audio
cube.GetComponent<AudioSource>().Play();
GameObject center = GameObject.Find("center");
Destroy(center);