I have turrets within my tower defence game which automatically find their target and fire projectiles, a bullet for the standard turret, a missile for the missile launcher and a laser for the laser turret. The problem I am having however is that these projectiles are hitting the feet of the enemies due to the fact that it is aiming for the enemies positions and the Y of the enemies is 0.5 so that it is just on top of the floor. How can I make it so that the turrets aim higher and hit the centre of the enemy. Thank you if you can help, as the turrets shooting the feet of the enemy can be a bit visually ugly.
This is the code responsible for the way turrets lock onto targets.
void LockOnTarget()
{
Vector3 dir = target.position - transform.position;
Quaternion lookRotation = Quaternion.LookRotation(dir);
Vector3 rotation = Quaternion.Lerp(partToRotate.rotation, lookRotation, Time.deltaTime * turnSpeed).eulerAngles;
partToRotate.rotation = Quaternion.Euler(0f, rotation.y, 0f);
}