Game Development Reference
In-Depth Information
Illustration 62: A scene to test ray cast shooting
Now we have to specify what happens when an object is shot. Hit reaction can vary from
an object to another, depending on how does each object respond to OnRaycastHit message
sent by RaycastShooter . To illustrate the variance of hit reactions, we are going to write
two scripts that handle OnRaycastHit differently. The first one is BulletHoleMaker , shown in
Listing 52. As the name suggests, this script creates a bullet hole at the position of the hit.
This hole is in fact an instance of a prefab, which is made of a quad with bullet hole texture
on it.
Search WWH ::




Custom Search