Exemple #1
0
    // Start is called before the first frame update
    void Start()
    {
        numberOfBones = 6;

        // init bone references
        for (int i = 1; i <= numberOfBones; i++)
        {
            GameObject t = GameObject.Find("Bone_" + i);
            bones.Add(t);
            Transform     tr = t.GetComponent <Transform>();
            TransformInfo ti = new TransformInfo
            {
                pos    = tr.localPosition,
                rotate = tr.localRotation,
                scale  = tr.localScale
            };
            originalTransform.Add(ti);
        }

        gBoneState = BoneState.ShowAll;

        // slider enable/disable
        slider  = GameObject.Find("PinchSlider");
        slider2 = GameObject.Find("PinchSliderHor");

        // scale functions
        gScaleState = ScaleState.Original;

        // menus
        nearMenu = GameObject.Find("NearMenu");
        handMenu = GameObject.Find("HandMenu");

        //document slate
        docSlate = GameObject.Find("Slate");
        Material firstPage = docSlate.transform.Find("ContentQuad").gameObject.GetComponent <Pages>().getMat();

        docSlate.transform.Find("ContentQuad").gameObject.GetComponent <Renderer>().material = firstPage;
        docSlate.SetActive(false);

        GameObject bone_1_ref = GameObject.Find("Bone_1");

        // bone manipulation components
        boneBoundingBox         = bone_1_ref.transform.Find("BoneGroup").gameObject.GetComponent <BoundingBox>();
        boneManipulationHandler = bone_1_ref.transform.Find("BoneGroup").gameObject.GetComponent <ManipulationHandler>();

        // CT manipulation components
        ctBoundingBox         = bone_1_ref.transform.Find("CTGroup").gameObject.GetComponent <BoundingBox>();
        ctManipulationHandler = bone_1_ref.transform.Find("CTGroup").gameObject.GetComponent <ManipulationHandler>();

        // group manipulation components
        allBoundingBox         = bone_1_ref.GetComponent <BoundingBox>();
        allManipulationHandler = bone_1_ref.GetComponent <ManipulationHandler>();

        handMenu.SetActive(false);
    }
Exemple #2
0
        private void Start()
        {
            ManipulationHandler mh = GetComponent <ManipulationHandler>();

            contextInfo = gameObject.EnsureComponent <CursorContextInfo>();
            contextInfo.ObjectCenter = transform;

            mh.OnHoverEntered.AddListener(ManipulatorHoverEntered);
            mh.OnHoverExited.AddListener(ManipulatorHoverExited);
            mh.OnManipulationStarted.AddListener(ManipulationStarted);
            mh.OnManipulationEnded.AddListener(ManipulationEnded);
        }