How can i make first person character to rotate smooth to the rotation and position of a camera ?

I need that when the player touch the spaceship the character will rotate smooth to the camera rotation and position that is on the spaceship.

The first person character have Capsule Collider and Is Trigger is unchecked. It have also a Rigidbody and Use Gravity is checked and also on Freeze Rotation X and Z are checked.

And as child the Main Camera.

It have attached to it two scripts the first is Character Controller script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CharacterController : MonoBehaviour
{
    public float speed = 10.0f;

    // Use this for initialization
    void Start ()
    {
       
    }
   
    // Update is called once per frame
    void Update ()
    {
        float translatioin = Input.GetAxis("Vertical") * speed;
        float straffe = Input.GetAxis("Horizontal") * speed;
        translatioin *= Time.deltaTime;
        straffe *= Time.deltaTime;

        transform.Translate(straffe, 0, translatioin);

        if (Input.GetKeyDown("escape"))
            Cursor.lockState = CursorLockMode.None;
    }
}

The second script is Enter Exist Spaceship:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EnterExitSpaceship : MonoBehaviour
{
    public Camera mainCamera;
    public Camera spaceshipCam;

    private void OnTriggerEnter(Collider other)
    {
        transform.rotation = Quaternion.Slerp(transform.rotation, spaceshipCam.transform.rotation, Time.deltaTime * 1);
    }

    private void OnTriggerExit(Collider other)
    {
        
    }

    // Use this for initialization
    void Start () {
       
    }
   
    // Update is called once per frame
    void Update () {
       
    }
}

What i want to do is when the character touch the spaceship and trigger the event OnTriggerEnter that the character will rotate smooth to the direction rotation and position of the spaceship camera.

The spaceship have it’s own camera. I added the camera and set the camera position and rotation to looks like the character will view from the spaceship.
The spaceship have a Box Collider and Is Trigger is checked.

What i want to do is once the player touch/enter the spaceship to rotate smooth the character to the position and rotation of the spaceship camera and to be able and keep the character to be moving the camera around viewing around and also to move around so if the user leaving the spaceship to return to the main camera view.

But if the spaceship is in a move keep rotating the camera but don’t let the character to move. The character can leave the spaceship (OnTriggerExit) only if the spaceship is not moving.

This is a screenshot of the First person controller inspector:

And a screenshot of the spaceship it’s inspector:

So when the character is in the spaceship the character will rotate to the position and rotation of the spaceship camera. The player will be able to keep moving the camera around viewing around and also to keep moving the character.

If the spaceship is on a move prevent from the character to move but keep him to be able to move the camera around viewing 360 degrees.

Solution more or less. I will play with the script later but this making the character to rotate smooth when entering the spaceship.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EnterExitSpaceship : MonoBehaviour
{
    public Camera spaceshipCam;
    private bool isLerp = false;

    private void OnTriggerEnter(Collider other)
    {
        isLerp = true;

        print("Im in !");
    }

    private void OnTriggerExit(Collider other)
    {
        isLerp = false;

        print("Im out !");
    }
   
    void Update ()
    {
      if (isLerp == true)
        {
            transform.rotation = Quaternion.Lerp(transform.rotation, spaceshipCam.transform.rotation, Time.deltaTime * 1);
        }
    }
}