Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Out of curiosity how did you get the missile to follow the tank?

It wasn't actually too much code. I was able piece it together from examples online.  It probably going to be ugly but I pasted it below.  The first line move the missile towards the player, the rest rotate the missile to point at the player.

transform.position = Vector3.MoveTowards(transform.position, player.transform.position, 2.8f * Time.deltaTime);


Vector2 movementDirection = player.transform.position - transform.position;

movementDirection.Normalize();

if (movementDirection != Vector2.zero)

{

                Quaternion toRotation = Quaternion.LookRotation(Vector3.forward, movementDirection);

                transform.rotation = Quaternion.RotateTowards(transform.rotation, toRotation, 720 * Time.deltaTime);

}