How do I use them?
In order to use OnTriggerEnter we need to add a rigidbody component to our gameobject/s.
Ticking use gravity will produce similar to below.
In order for us to have the sphere do more than roll off the surface, we need to
attach a script to the gameobject. In the script, if we have:
Then we also need to click on Is Trigger in the collider of the object.
And the below will happen, instead of rolling off:
Now, if we remove the script, still keeping is trigger ticked the below will happen:
Now, if we add a rigidbody component to the rectangle as well, and not have gravity ticked on the rectangle. Also, making sure that Is Trigger is not ticked on both. The below will happen when started.
Then changing the script on the sphere to (similar to above):
The below will happen.
As can be seen, the sphere adds a force to the rectangle when it touches the rectangle and then transports to its starting position.