Time for action – creating the target
We have all the pieces; the next step is to put them together.
Start by dragging the Target model from the Project window to the Hierarchy window. This creates a new instance of the
target
object.By selecting the new
target
object, we can see that it already has anAnimator
component attached; we just need to add a reference toAnimatorController
that we created. Do this by draggingTargetController
from the Project window and dropping it on the Animator component's Controller field, just as with all the other object references we have set up so far.Also, we need to add the
Target
script to the object and connect a reference to theAnimator
component in its relevant field.The last thing to do to the target object is to add a collider to actually receive our cannon shots. Unfortunately, because the
target
object uses bones and a rig to animate, it is not as simple as adding a collider directly to the mesh we will be shooting at. Instead, we need to create...