how to change 2d image object when I tilt my smartphone

  1. I want to do this…
    I want to change 2d image a to b when I tilt my smartphone.

I just start Unity in this month so I don’t know how to solve this problem.
Please help me. Thank you.

  1. I tried this
    With two objects in hand.
    ①for rotated
    ②for trigger when this object collision

  2. Problem
    It does not print “hit!!!” despite the collision.

I write code following this.

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

public class ColliderManager : MonoBehaviour
{
    private Gyroscope m_gyro;

    // Start is called before the first frame update
    void Start()
    {
        Input.gyro.enabled = true;
    }
    void Update()
    {
        m_gyro = Input.gyro;
        transform.rotation = m_gyro.attitude;
    }
    private void OnGUI()
    {
        var rect1 = new Rect(30, 30, 600, 50);
        var rect2 = new Rect(30, 60, 600, 50);
        GUI.skin.label.fontSize = 30;
        GUI.Label(rect1, "attitude=" + m_gyro.attitude);
        GUI.Label(rect2, "rotationRate=" + m_gyro.rotationRate);
    }

    private void OnTriggerEnter(Collider collider)
    {
        if (collider.gameObject.tag == "Cube2")
        {
            print("hit!!!");
        }
    }
}

I refer to following this sites.

Thank you for read. I solved following code.

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

public class ColliderManager : MonoBehaviour
{


    // Start is called before the first frame update
    void Start()
    {
        Input.gyro.enabled = true;
    }
    void Update()
    {
        Quaternion gyro = Input.gyro.attitude;
        if (gyro.x > 0.5) 
        {
        // X for you need
        }
        if (gyro.y > 0.5) 
        {
        // Y for you need
        }
    }


}