Two Objects - Contraction?

I have two objects. One sphere is moving left and one sphere is moving right. Now, when they’re too close (when colliders touching), they should contracted and destroyed.

How can I solve this?

alt text

There are many ways to do this. I believe you mean “collision” as opposed to “contraction”.

Simplest way would be something like:

void OnTriggerEnter (Collider col)
    // Do some check here to make sure it's the object we want to destroy on
    if (someCheck)

We’d need more information about the exact behaviour you want.

Really you should just look up collision detection. There are lots of official resources on the Unity website. Start here:

You may find it helpful to do some more intro tutorials before asking more questions on forums like this.