private CylinderTargetBehaviour CreateCylinderTargetBehaviour(CylinderTarget cylinderTarget)
    {
        GameObject cylinderTargetObject = new GameObject();
        CylinderTargetBehaviour newCTB  =
            cylinderTargetObject.AddComponent <CylinderTargetBehaviour>();

        IEditorCylinderTargetBehaviour newEditorCTB = newCTB;

        Debug.Log("Creating Cylinder Target with values: " +
                  "\n ID:           " + cylinderTarget.ID +
                  "\n Name:         " + cylinderTarget.Name +
                  "\n Path:         " + newEditorCTB.DataSetPath +
                  "\n Side Length:  " + cylinderTarget.GetSideLength() +
                  "\n Top Diameter: " + cylinderTarget.GetTopDiameter() +
                  "\n Bottom Diam.: " + cylinderTarget.GetBottomDiameter());


        // Set Cylinder Target attributes.
        newEditorCTB.SetNameForTrackable(cylinderTarget.Name);
        newEditorCTB.SetDataSetPath(newEditorCTB.DataSetPath);
        var sidelength = cylinderTarget.GetSideLength();

        newEditorCTB.transform.localScale = new Vector3(sidelength, sidelength, sidelength);
        newEditorCTB.CorrectScale();
        newEditorCTB.SetAspectRatio(cylinderTarget.GetTopDiameter() / sidelength,
                                    cylinderTarget.GetBottomDiameter() / sidelength);
        newEditorCTB.InitializeCylinderTarget(cylinderTarget);
        return(newCTB);
    }
Example #2
0
    private CylinderTargetAbstractBehaviour CreateCylinderTargetBehaviour(CylinderTarget cylinderTarget)
    {
        GameObject gameObject = new GameObject();
        CylinderTargetAbstractBehaviour behaviour  = BehaviourComponentFactory.Instance.AddCylinderTargetBehaviour(gameObject);
        IEditorCylinderTargetBehaviour  behaviour2 = behaviour;

        Debug.Log(string.Concat(new object[] { "Creating Cylinder Target with values: \n ID:           ", cylinderTarget.ID, "\n Name:         ", cylinderTarget.Name, "\n Path:         ", behaviour2.DataSetPath, "\n Side Length:  ", cylinderTarget.GetSideLength(), "\n Top Diameter: ", cylinderTarget.GetTopDiameter(), "\n Bottom Diam.: ", cylinderTarget.GetBottomDiameter() }));
        behaviour2.SetNameForTrackable(cylinderTarget.Name);
        behaviour2.SetDataSetPath(behaviour2.DataSetPath);
        float sideLength = cylinderTarget.GetSideLength();

        behaviour2.transform.localScale = new Vector3(sideLength, sideLength, sideLength);
        behaviour2.CorrectScale();
        behaviour2.SetAspectRatio(cylinderTarget.GetTopDiameter() / sideLength, cylinderTarget.GetBottomDiameter() / sideLength);
        behaviour2.InitializeCylinderTarget(cylinderTarget);
        return(behaviour);
    }
Example #3
0
        private CylinderTargetAbstractBehaviour CreateCylinderTargetBehaviour(CylinderTarget cylinderTarget)
        {
            GameObject gameObject = new GameObject();
            CylinderTargetAbstractBehaviour cylinderTargetAbstractBehaviour = BehaviourComponentFactory.Instance.AddCylinderTargetBehaviour(gameObject);

            Debug.Log(string.Concat(new object[]
            {
                "Creating Cylinder Target with values: \n ID:           ",
                cylinderTarget.ID,
                "\n Name:         ",
                cylinderTarget.Name,
                "\n Path:         ",
                ((CylinderTargetImpl)cylinderTarget).DataSet.Path,
                "\n Side Length:  ",
                cylinderTarget.GetSideLength(),
                "\n Top Diameter: ",
                cylinderTarget.GetTopDiameter(),
                "\n Bottom Diam.: ",
                cylinderTarget.GetBottomDiameter()
            }));
            cylinderTargetAbstractBehaviour.InitializeTarget(cylinderTarget, true);
            return(cylinderTargetAbstractBehaviour);
        }
Example #4
0
    private CylinderTargetBehaviour CreateCylinderTargetBehaviour(CylinderTarget cylinderTarget)
    {
        GameObject cylinderTargetObject = new GameObject();
        CylinderTargetBehaviour newCTB =
            cylinderTargetObject.AddComponent<CylinderTargetBehaviour>();

        IEditorCylinderTargetBehaviour newEditorCTB = newCTB;

        Debug.Log("Creating Cylinder Target with values: " +
                  "\n ID:           " + cylinderTarget.ID +
                  "\n Name:         " + cylinderTarget.Name +
                  "\n Path:         " + newEditorCTB.DataSetPath +
                  "\n Side Length:  " + cylinderTarget.GetSideLength() +
                  "\n Top Diameter: " + cylinderTarget.GetTopDiameter() +
                  "\n Bottom Diam.: " + cylinderTarget.GetBottomDiameter());

        // Set Cylinder Target attributes.
        newEditorCTB.SetNameForTrackable(cylinderTarget.Name);
        newEditorCTB.SetDataSetPath(newEditorCTB.DataSetPath);
        var sidelength = cylinderTarget.GetSideLength();
        newEditorCTB.transform.localScale = new Vector3(sidelength, sidelength, sidelength);
        newEditorCTB.CorrectScale();
        newEditorCTB.SetAspectRatio(cylinderTarget.GetTopDiameter()/sidelength,
                                    cylinderTarget.GetBottomDiameter()/sidelength);
        newEditorCTB.InitializeCylinderTarget(cylinderTarget);
        return newCTB;
    }