how to get local "up" in global space?

hello everyone, I am trying to do a script for the camara to moove smoothely, it was all working perfectly untill i added “transform.LookAt”, this made my camera unable to go upside down and, since it`s for a space fighter, it becomes disturbimg. tried the following(according to the little i remember about vectors):

localUp = new Vector3(Mathf.Cos(transform.rotation.z), Mathf.Cos(transform.rotation.y),
		                      Mathf.Cos(transform.rotation.x));

*local up is a vector 3 variable

all i got from it was the camera to start sideways and to wobble when i turn. im out of ideas, if someone knows how to do this pls tell me.

thanks in advanced.

Not sure it is the right solution for your problem, but local up in world space is ‘transform.up’. You can get it also by ‘transform.TransformDirection(Vector3.up)’.