In this chapter, we have optimized the AIController.js
by changing from the Physics.CapsuleCast
to Physics.Raycast
to increase the FPS in our game. Then, we learned how to create the ragdoll object and apply it to the character when it is dead by using Instatiate()
and Destroy()
functions to clone the ragdoll prefab and replace the old object.
Then, we created the destructible Wall
and destroyed it when we shot at it by adding some script to the rocket
script.
We also created the Rockslide
game object, the Rocks
script to enable and disable rigidbody
of the rocks, and the triggerArea
game object to make the object fall down when the player hits the triggerArea
by using another script (TriggerArea
).
So, let's take a look at the screenshot of what we have done so far:
The rock falls down when the player hits the trigger area as shown in the previous screenshot.
The player shoots and destroys the destructible wall as shown in the previous screenshot.
The AI gets killed as shown in the previous screenshot.
The player gets killed as shown in the previous screenshot.
18.191.168.8