Check is two game objects are colliding

I have an object (computer) rotating base on mouse input and a key pressed but i don’t want my rotating object (a computer) to rotate if it breaks into the table surface.
Example : picture

The script :

function Update(){
	if (myGuiTexture.enabled == true){
		if (Input.GetKey(UnityEngine.KeyCode.Keypad1) || Input.GetKey(UnityEngine.KeyCode.Alpha1)){
		//here i want to check if the computer is colliding with the table
           //if not {
			rotation = Vector3(Input.GetAxis("Mouse Y"), Input.GetAxis("Mouse X"), 0);
	        myGameObject.transform.Rotate(rotation);
		   }
        }
		
	}
}

I think this should work. Make sure to attach it to your computer gameObject and attach a rigidbody to it (turn off gravity if you want to avoid weirdness). On your table, make a new tag called “world” and add the table.

Both objects should have colliders attached.

var oldPosition: Transform;

function Update()
{
    oldPosition = transform.position;

    if (myGuiTexture.enabled == true)
    {
       if (Input.GetKey(UnityEngine.KeyCode.Keypad1) ||  Input.GetKey(UnityEngine.KeyCode.Alpha1))
       {
           rotation = Vector3(Input.GetAxis("Mouse Y"), Input.GetAxis("Mouse X"), 0);
           myGameObject.transform.Rotate(rotation);
       }
    }
}


function OnTriggerEnter (collider : Collider)
{
      if(collider.transform.tag == "world")
      {
           transform.position = oldPosition;
      }
}