hey guts i am havind problems for days now with the rotation of my turrent`s guns they dont rotate like i wanted the body rotates on y no problem follows me
but the guns do rotate on the correct axis Z but the problem is when i am at lets say a few units away from the turrent the guns rotate towards me when i get closer they do rotate with me getting closer but when i jump they dont rotate to my hight position
// This is the Rotation of my turrent`s body works fine!..Rotation Y.
Vector3 dir = target.position - transform.position;
Quaternion lookRotation = Quaternion.LookRotation(dir);
Vector3 rotation = Quaternion.Lerp(partToRotate.rotation, lookRotation, Time.deltaTime * rotationSpeed).eulerAngles;
partToRotate.rotation = Quaternion.Euler(0f, rotation.y, 0f);
// This is the rotation of my turrents Guns that are a child of the body Rotation Z..
Vector3 targetPosition = new Vector3(target.position.x, transform.position.z, target.transform.position.z);
partToRotategunarms.transform.LookAt(targetPosition);