I want my camera to be smooth on only the Y axis.How do I do that it?
Current code:
public Transform target;
public float smoothSpeed = 0.3f;
public float offsetX = 1f;
public float offsetY = 1f;
public float offsetZ = 1f;
void FixedUpdate ()
{
Vector3 pos = transform.position;
pos.x = target.position.x;
pos.y = target.position.y;
pos.z = target.position.z;
Vector3 positionz = pos.z;
Vector3 smoothedPosition = Vector3.Lerp(transform.position, pos, smoothSpeed);
transform.position = smoothedPosition;
}