Game Development Reference
In-Depth Information
Before jumping to code, we have to set Is Trigger property in the collider of the upper plane
to true . Trigger colliders are different in terms of collision resolution. The physics simulator
tells us when an object collides with a trigger, but it does not handle this collision phys-
ically. In other words, when a ball hits the upper plane it is going to simply keep falling; as
the trigger does not block the movement of other objects. Now we want to write a script in
which we are going to handle the collisions between a ball and the other objects. The script
is shown in Listing 40, and we are going to attach it to all balls in the scene.
Listing 40: A script for handling collisions
Search WWH ::




Custom Search