Exemplo n.º 1
0
        protected GameObject BuildGameObject(Dictionary <String, OBJObjectBuilder> builderDict)
        {
            List <GameObject> objObjects = new List <GameObject>();

            foreach (var builder in builderDict)
            {
                if (builder.Value.PushedFaceCount == 0)
                {
                    continue;
                }

                var builtObj = builder.Value.Build();

                objObjects.Add(builtObj);
            }

            GameObject obj = new GameObject(/*_objInfo != null ? Path.GetFileNameWithoutExtension(_objInfo.Name) :*/ "WavefrontObject");

            obj.transform.localScale = new Vector3(-0.001f, 0.001f, 0.001f);

            foreach (var g in objObjects)
            {
                g.transform.SetParent(obj.transform, false);
            }

            ObjBox box = CalculateBigBox(builderDict);

            ObjBoxComponent.FromGameObject(obj, box);

            return(obj);
        }
Exemplo n.º 2
0
    public static ObjBoxComponent FromGameObject(GameObject gameObject, ObjBox objBox)
    {
        ObjBoxComponent instance = null;

        if (gameObject != null)
        {
            instance = gameObject.AddComponent <ObjBoxComponent>();
        }
        instance.box = objBox;
        return(instance);
    }