Beispiel #1
0
    private void CreateModel()
    {
        if (container == null)
        {
            container = gameObject.transform;
        }

        float x = container.position.x;
        float y = container.position.y;
        float z = container.position.z;

        clone = Instantiate(baseFoodModel, new Vector3(x, y, z), Quaternion.identity, container);

        //set clone scale to 1
        clone.transform.localScale = new Vector3(1, 1, 1);

        Transform baseFoodTransform = baseFoodModel.GetComponent <Transform>();

        if (baseFoodTransform != null)
        {
            clone.transform.rotation = baseFoodTransform.rotation;
        }

        //fit the box collider to the new model
        FitBoxCollider fit = GetComponent <FitBoxCollider>();

        fit.GetFit(1);
    }
    void AddItemCollider(GameObject item)
    {
        FitBoxCollider itemFit = item.AddComponent <FitBoxCollider>();

        itemFit.GetFit(itemScale * 2f);
    }