While developing games which involve an action element, we often need to figure out a way to collide with a moving target. Such scenarios can be typically called a ‘hitting a moving target’ problem. This is particularly prominent in tower defense games or missile command like games. We may need to create an AI or algorithm which could figure out the enemy’s motion and fire at it.
In the previous tutorial, we started looking at how 2D physics joints work in Unity and how to use them to achieve great effects (without sacrificing the game performance). In that tutorial, we covered thedistance, hinge, target, and fixed joints.
Unity is a well known, well documented, and very recognised game engine. It’s a multi-platform solution, and it also allows you to create games or applications aimed at several platforms (iOS, Android, Web, and PC, among others). Originally, Unity was focused on 3D development, but recent releases provide tools for 2D development.