예제 #1
0
    private SceneObject CreateSceneObject(Transform objTransform)
    {
        SceneObject sceneObject = new SceneObject(); //blank object

        //name
        sceneObject.Name = objTransform.name;

        //transform properties
        sceneObject.LocalPosition = objTransform.localPosition;
        sceneObject.LocalRotation = objTransform.localEulerAngles;
        sceneObject.LocalScale    = objTransform.localScale;

        //model and texture
        ObjectIdentifier objectIdentifier = objTransform.GetComponent <ObjectIdentifier>();

        sceneObject.Model   = objectIdentifier.GetObjFilePath();
        sceneObject.Texture = objectIdentifier.GetTexturePath();

        //parent
        if (objTransform.parent.GetComponent <LevelExporterScript>())
        {
            sceneObject.Parent = ""; //blank, if no parent
        }
        else
        {
            sceneObject.Parent = objTransform.parent.name;
        }

        return(sceneObject);
    }