ABSTRACT

Raycasting is a common and useful Action. In this chapter, we will create a Raycast Action to check if, when our player shoots, the “bullets” intercept the cyborgNinja GameObject. If the ray does connect, we will send a message to cyborgNinja informing it that it has been hit. Previously, we learned to receive messages using Global Transitions. To send messages from FSMs, we will learn to use the Send Event action. Upon receipt, cyborgNinja will then know to play its hit animation, wait, and deactivate according to our earlier instructions. When things go wrong, we will have to troubleshoot.