Object rotation corresponds to another objects rotation but on different axis

I have a character in a 3D game who moves along the x-axis and z-axis, rotating around the y-axis.

I would like to have a compass (on my UI Canvas) which rotates around the x-axis to reflect the position of the character.

I have tried various things, but it’s all a bit beyond me!

This is what I’ve done (but the ‘transform.Quaternion(0f, 0f, compassRotationZ)’ bit is clearly wrong):

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

public class CompassManager : MonoBehaviour {

    public GameObject player;
    private PlayerController playerController;
    public Quaternion compassRotation;
    public float compassRotationZ;
    public float playerRotationY;
    private float compassDirection = 0f;

    // Use this for initialization
    void Start()
    {
        playerController = player.GetComponent<PlayerController>();
    }

    // Update is called once per frame
    void Update()
    {
        playerRotationY = playerController.transform.rotation.y;
        compassRotationZ = playerRotationY;
        RotateCompass();
        transform.rotation = compassRotation;
    }

    void RotateCompass()
    {
        compassRotation = transform.Quaternion(0f, 0f, compassRotationZ);
    }
}

Any help would be very much appreciated!

Fixed it :

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

public class CompassManager : MonoBehaviour {

    public GameObject player;
    private PlayerController playerController;
    public Quaternion compassRotation;
    private float compassDirection = 0f;

    // Use this for initialization
    void Start()
    {
        playerController = player.GetComponent<PlayerController>();
    }

    // Update is called once per frame
    void Update()
    {
        compassRotation = transform.rotation;
        RotateCompass();
        transform.rotation = compassRotation;
    }

    void RotateCompass()
    {
        compassRotation.z = playerController.transform.rotation.y;
    }
}