示例#1
0
    private ImageTargetBehaviour CreateImageTarget(int id,
                                                   string itName,
                                                   Vector2 itSize)
    {
        GameObject           imageTargetObject = new GameObject();
        ImageTargetBehaviour newITB            =
            imageTargetObject.AddComponent <ImageTargetBehaviour>();

        Debug.Log("Creating Image Target with values: " +
                  "\n ID:           " + id +
                  "\n Name:         " + itName +
                  "\n Path:         " + this.Path +
                  "\n Storage Type: " + this.FileStorageType.ToString() +
                  "\n Size:         " + itSize.x + "x" + itSize.y);

        // Set Image Target attributes.
        newITB.InitializeID(id);
        newITB.TrackableName        = itName;
        newITB.DataSetPath          = this.Path;
        newITB.DataSetStorageType   = this.FileStorageType;
        newITB.transform.localScale = new Vector3(itSize.x, 1.0f, itSize.y);
        newITB.CorrectScale();
        newITB.AspectRatio = itSize[1] / itSize[0];

        return(newITB);
    }