So i have a makeshift turret using the Unity primitive meshes and want to have the base rotate only left and right to align with a moving target, and the barrels to look up and down to aim at it but i’m not sure how.
void LookAt () { }
You can make the turret base and barrel both look at the target and zero out the rotations that you don’t want rotated.
Something like…
transform.LookAt(target); transform.x = 0; transform.z = 0;
that would be for the base. You would do something similar for the barrel.