Tower Defense lock on issues

Updated on January 5, 2019 in [A] Tutorials
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
1 on January 5, 2019

 the brackeys tower defense tutorial, I am making my game in 2d and I’m creating all the sprites and everything, I have been having trouble getting the tower to lock on to the enemy, I know the tower targets the enemy, but because I am in 2D the method of rotating the tower for 3D just makes the tower disappear. Thanks in advanced for any tips!


Vector3 dir = target.position – transform.position;
Quaternion lookRotation = Quaternion.LookRotation(dir);
Vector3 rotation = lookRotation.eulerAngles;
partToRotate.rotation = Quaternion.Euler(0f, 0f, rotation.z); 

  • Liked by
0 on January 5, 2019
  • Liked by