Game Development Reference
In-Depth Information
Classified intel
In this step, we have used both the Physics.Raycast() functions to check if there is
anything blocking the enemy movement direction or the rocket bullet direction. In the
CanShoot() function, we basically cast the ray from the position of the enemy's rocket
launcher to the player by checking to see if there is anything blocking it, as shown in the
following diagram:
Then, we also use the Physics.Raycast() function in the Jump() function to check
if the enemy hits the wall or not. If it hits, we will check for the height for the enemy to
jump over or not. By calculating from the raycast hitting position to the maximum y posi-
tion of the wall, we can check the height, as shown in the following diagram:
Search WWH ::




Custom Search