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

public class Scrivania : MonoBehaviour {

static GameObject scrivania, cameretta;
static Vector3 pSC, sSC, sSP;
// Start is called before the first frame update
static internal void Start()
{
    cameretta = GameObject.Find("Cameretta");
    scrivania = GameObject.CreatePrimitive(PrimitiveType.Cube);
    scrivania.name = "Scrivania";

    sSP = cameretta.transform.localScale;
    sSC = scrivania.transform.localScale = new Vector3(100, 4, 90);

    pSC.x += (sSP.x / 2) - (sSC.x / 2);        // Allinea il lato z dei due usando lasse x
    pSC.y += (sSP.y / 2) + (sSC.y / 2) + 70;   // Sormonta l'oggetto 
    pSC.z -= (sSP.z / 2) - (sSC.z / 2);        // Allinea il lato x dei due usando lasse z

    pSC = scrivania.transform.position = new Vector3(pSC.x, pSC.y, pSC.z);
}

// Update is called once per frame
void Update()
{

}

}