private void OnEnable()
        {
            if (GetComponent <VRTK_ControllerEvents>() == null)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_ControllerAppearance_Example", "VRTK_ControllerEvents", "the same"));
                return;
            }

            events            = GetComponent <VRTK_ControllerEvents>();
            highligher        = GetComponent <VRTK_ControllerHighlighter>();
            tooltips          = GetComponentInChildren <VRTK_ControllerTooltips>();
            currentPulseColor = pulseColor;
            highlighted       = false;

            //Setup controller event listeners
            events.TriggerPressed    += DoTriggerPressed;
            events.TriggerReleased   += DoTriggerReleased;
            events.ButtonOnePressed  += DoButtonOnePressed;
            events.ButtonOneReleased += DoButtonOneReleased;
            events.ButtonTwoPressed  += DoButtonTwoPressed;
            events.ButtonTwoReleased += DoButtonTwoReleased;
            events.StartMenuPressed  += DoStartMenuPressed;
            events.StartMenuReleased += DoStartMenuReleased;
            events.GripPressed       += DoGripPressed;
            events.GripReleased      += DoGripReleased;
            events.TouchpadPressed   += DoTouchpadPressed;
            events.TouchpadReleased  += DoTouchpadReleased;

            tooltips.ToggleTips(false);
        }
        private void Start()
        {
            if (GetComponent <VRTK_ControllerEvents>() == null)
            {
                Debug.LogError("VRTK_ControllerEvents_ListenerExample is required to be attached to a Controller that has the VRTK_ControllerEvents script attached to it");
                return;
            }

            events   = GetComponent <VRTK_ControllerEvents>();
            actions  = GetComponent <VRTK_ControllerActions>();
            tooltips = GetComponentInChildren <VRTK_ControllerTooltips>();

            //Setup controller event listeners
            events.TriggerPressed  += new ControllerInteractionEventHandler(DoTriggerPressed);
            events.TriggerReleased += new ControllerInteractionEventHandler(DoTriggerReleased);

            events.ApplicationMenuPressed  += new ControllerInteractionEventHandler(DoApplicationMenuPressed);
            events.ApplicationMenuReleased += new ControllerInteractionEventHandler(DoApplicationMenuReleased);

            events.GripPressed  += new ControllerInteractionEventHandler(DoGripPressed);
            events.GripReleased += new ControllerInteractionEventHandler(DoGripReleased);

            events.TouchpadPressed  += new ControllerInteractionEventHandler(DoTouchpadPressed);
            events.TouchpadReleased += new ControllerInteractionEventHandler(DoTouchpadReleased);

            tooltips.ToggleTips(false);
        }
        private void Start()
        {
            if (GetComponent <VRTK_ControllerEvents>() == null)
            {
                VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_ControllerAppearance_Example", "VRTK_ControllerEvents", "the same"));
                return;
            }

            events   = GetComponent <VRTK_ControllerEvents>();
            tooltips = GetComponentInChildren <VRTK_ControllerTooltips>();

            //Setup controller event listeners
            events.TriggerPressed  += new ControllerInteractionEventHandler(DoTriggerPressed);
            events.TriggerReleased += new ControllerInteractionEventHandler(DoTriggerReleased);

            events.ButtonOnePressed  += new ControllerInteractionEventHandler(DoButtonOnePressed);
            events.ButtonOneReleased += new ControllerInteractionEventHandler(DoButtonOneReleased);

            events.ButtonTwoPressed  += new ControllerInteractionEventHandler(DoButtonTwoPressed);
            events.ButtonTwoReleased += new ControllerInteractionEventHandler(DoButtonTwoReleased);

            events.TouchpadTouchStart += new ControllerInteractionEventHandler(DoTouchpadTouchStart);
            events.TouchpadTouchEnd   += new ControllerInteractionEventHandler(DoTouchpadTouchEnd);

            events.GripPressed  += new ControllerInteractionEventHandler(DoGripPressed);
            events.GripReleased += new ControllerInteractionEventHandler(DoGripReleased);

            //  events.TouchpadPressed += new ControllerInteractionEventHandler(DoTouchpadPressed);
            //  events.TouchpadReleased += new ControllerInteractionEventHandler(DoTouchpadReleased);

            tooltips.ToggleTips(false);
        }
    //開始
    private void Start()
    {
        if (GetComponentInParent <VRTK_ControllerEvents>() == null)
        {
            Debug.LogError("VRTK_ControllerEvents_ListenerExample is required to be attached to a SteamVR Controller that has the VRTK_ControllerEvents script attached to it");
            return;
        }

        //取得是件
        events    = GetComponentInParent <VRTK_ControllerEvents>();
        actions   = GetComponentInParent <VRTK_ControllerActions>();
        _tooltips = GetComponent <VRTK_ControllerTooltips>();//取得

        //Setup controller event listeners
        events.TriggerPressed  += new ControllerInteractionEventHandler(DoTriggerPressed);
        events.TriggerReleased += new ControllerInteractionEventHandler(DoTriggerReleased);

        events.ApplicationMenuPressed  += new ControllerInteractionEventHandler(DoApplicationMenuPressed);
        events.ApplicationMenuReleased += new ControllerInteractionEventHandler(DoApplicationMenuReleased);

        events.GripPressed  += new ControllerInteractionEventHandler(DoGripPressed);
        events.GripReleased += new ControllerInteractionEventHandler(DoGripReleased);

        events.TouchpadPressed  += new ControllerInteractionEventHandler(DoTouchpadPressed);
        events.TouchpadReleased += new ControllerInteractionEventHandler(DoTouchpadReleased);

        //是不是總是顯示提示
        AlwaysShowHint(_alwaysShow);
    }
예제 #5
0
    IEnumerator Start()
    {
        while (vrtk_manager.modelAliasLeftController.transform.Find("body") == null || vrtk_manager.modelAliasRightController.transform.Find("body") == null)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        leftInteractTouch       = vrtk_manager.scriptAliasLeftController.GetComponent <VRTK_InteractTouch> ();
        rightInteractTouch      = vrtk_manager.scriptAliasRightController.GetComponent <VRTK_InteractTouch> ();
        leftInteractUse         = vrtk_manager.scriptAliasLeftController.GetComponent <VRTK_InteractUse> ();
        rightInteractUse        = vrtk_manager.scriptAliasRightController.GetComponent <VRTK_InteractUse> ();
        rightControllerTooltips = vrtk_manager.scriptAliasRightController.GetComponentInChildren <VRTK_ControllerTooltips> ();
        leftControllerTooltips  = vrtk_manager.scriptAliasLeftController.GetComponentInChildren <VRTK_ControllerTooltips> ();

        playerInfoManager = FindObjectOfType <PlayerInfoManager> ();
        rightTeleporter   = vrtk_manager.scriptAliasRightController.transform.Find("Teleporter").gameObject;
        leftTeleporter    = vrtk_manager.scriptAliasLeftController.transform.Find("Teleporter").gameObject;

        FindObjectOfType <PlayerHealth> ().OnPlayerDied    += OnPlayerDied;
        FindObjectOfType <PlayerHealth> ().OnPlayerRevived += OnPlayerRevived;
        playerInfoManager.OnPlayerInfoViewOpened           += OnPlayerInfoOpenend;
        playerInfoManager.OnPlayerInfoViewClosed           += OnPlayerInfoClosed;

        SetOutfitterMode(OutfitterMode.EXPLORE);

        setupFinished = true;
    }
예제 #6
0
        private void Start()
        {
            if (GetComponent <VRTK_ControllerEvents>() == null)
            {
                Debug.LogError("VRTK_ControllerEvents_ListenerExample is required to be attached to a Controller that has the VRTK_ControllerEvents script attached to it");
                return;
            }

            events            = GetComponent <VRTK_ControllerEvents>();
            highligher        = GetComponent <VRTK_ControllerHighlighter>();
            tooltips          = GetComponentInChildren <VRTK_ControllerTooltips>();
            currentPulseColor = pulseColor;
            highlighted       = false;

            //Setup controller event listeners
            events.TriggerPressed  += new ControllerInteractionEventHandler(DoTriggerPressed);
            events.TriggerReleased += new ControllerInteractionEventHandler(DoTriggerReleased);

            events.ButtonOnePressed  += new ControllerInteractionEventHandler(DoButtonOnePressed);
            events.ButtonOneReleased += new ControllerInteractionEventHandler(DoButtonOneReleased);

            events.ButtonTwoPressed  += new ControllerInteractionEventHandler(DoButtonTwoPressed);
            events.ButtonTwoReleased += new ControllerInteractionEventHandler(DoButtonTwoReleased);

            events.StartMenuPressed  += new ControllerInteractionEventHandler(DoStartMenuPressed);
            events.StartMenuReleased += new ControllerInteractionEventHandler(DoStartMenuReleased);

            events.GripPressed  += new ControllerInteractionEventHandler(DoGripPressed);
            events.GripReleased += new ControllerInteractionEventHandler(DoGripReleased);

            events.TouchpadPressed  += new ControllerInteractionEventHandler(DoTouchpadPressed);
            events.TouchpadReleased += new ControllerInteractionEventHandler(DoTouchpadReleased);

            tooltips.ToggleTips(false);
        }
 // Use this for initialization
 void Start()
 {
     base.Start();
     foreach (var controller in GameObject.FindGameObjectsWithTag("GameController"))
     {
         Debug.Log("finding controller");
         var toolTips = controller.GetComponent <VRTK_ControllerTooltips>();
         if (toolTips != null)
         {
             debugToolTip                    = toolTips;
             debugToolTip.triggerText        = "default";
             debugToolTip.triggerInitialised = false;
             break;
         }
     }
     if (debugToolTip == null)
     {
         Debug.Log("debug tool tip on controller not found");
         debugToolTip = controller.GetComponent <VRTK_ControllerTooltips>();
         if (debugToolTip == null)
         {
             Debug.Log("not found again??");
         }
     }
     triggerObj.SetActive(false);
 }
예제 #8
0
    void Start()
    {
        InputManager.AddCallback(OnControllerCallback);

        tooltips = GetComponent <VRTK_ControllerTooltips>();

        tooltips.UpdateText(VRTK_ControllerTooltips.TooltipButtons.ButtonTwoTooltip, "Record a motion sequence");
    }
예제 #9
0
        private Tutorial tutorial;                                                                    //for getting the color of the tooltip during the tutorial step

        /// <summary>
        /// The start method initializes all necessary variables and sets up event listeners for the tooltip buttons and the place point
        /// </summary>
        void Start()
        {
            individualTooltips = GetComponentsInChildren <VRTK_ObjectTooltip>(true);
            events             = GetComponent <VRTK_ControllerEvents>();
            tooltips           = GetComponentInChildren <VRTK_ControllerTooltips>();
            tutorial           = GetComponentInParent <Tutorial>();
            SetupControllerEventListeners();
            InitializeIndividualTooltips();
        }
예제 #10
0
 // Use this for initialization
 void Start()
 {
     SpawnPosition = GameObject.FindGameObjectWithTag("SpawnPosition").transform;
     PMD           = GameObject.FindGameObjectWithTag("PMD").GetComponent <PaintMeshDeformer>();
     undoNredo     = GameObject.FindGameObjectWithTag("SLUR").GetComponent <UndoAndRedo> ();
     UIref         = GameObject.FindGameObjectWithTag("UINref").GetComponent <UINavigationSystem> ();
     dm            = GameObject.FindGameObjectWithTag("SM").GetComponent <VRSmooth> ();
     tooltip       = GameObject.FindGameObjectWithTag("tooltip").GetComponent <VRTK_ControllerTooltips> ();
 }
 private void Start()
 {
     InitVRInputListeners();
     tooltips = GetComponentInChildren <VRTK_ControllerTooltips>();
     if (tooltips != null)
     {
         tooltips.ToggleTips(false);
     }
 }
    private void OnEnable()
    {
        var evnts = GetComponentInParent <VRTK_ControllerEvents>();

        if (highlighter == null)
        {
            highlighter = evnts.GetComponentInChildren <VRTK_ControllerHighlighter>();
        }
        if (tooltips == null)
        {
            tooltips = evnts.GetComponentInChildren <VRTK_ControllerTooltips>();
        }
    }
 //總是顯示
 public void AlwaysShowHint(bool always)
 {
     _alwaysShow = always;
     try
     {
         //有時候會因為時間順序不同無法取得腳本
         _tooltips = GetComponentInChildren <VRTK_ControllerTooltips>();//取得
         _tooltips.ShowTips(_alwaysShow);
     }
     catch
     {
     }
 }
예제 #14
0
    public void Highlight()
    {
        tooltipsR = rightHand ? FetchHighlighter(VRTK_DeviceFinder.GetControllerRightHand()) : null;
        tooltipsL = leftHand ? FetchHighlighter(VRTK_DeviceFinder.GetControllerLeftHand()) : null;

        if (tooltipsR != null)
        {
            Highlight(tooltipsR);
        }
        if (tooltipsL != null)
        {
            Highlight(tooltipsL);
        }
    }
예제 #15
0
        public static TutorialState currentTutorialState; //keeps track of the current tutorial state

        /// <summary>
        /// Initializes all necessary variables and starts the tutorial
        /// </summary>
        void Start()
        {
            stepFinished = false;

            rightTooltips = rightController.GetComponentInChildren <VRTK_ControllerTooltips>();
            leftTooltips  = leftController.GetComponentInChildren <VRTK_ControllerTooltips>();
            rightToggling = rightController.GetComponent <Tooltips>();
            leftToggling  = leftController.GetComponent <Tooltips>();

            leftTooltips.ToggleTips(false);
            rightTooltips.ToggleTips(false);

            currentTutorialState = TutorialState.NONE;

            StartCoroutine(TutorialCoroutine());
        }
        /// <summary>
        /// Initializes all necessary variables and starts the tutorial
        /// </summary>
        void Start()
        {
            stepFinished = false;

            rightTooltips = rightController.GetComponentInChildren <VRTK_ControllerTooltips>();
            leftTooltips  = leftController.GetComponentInChildren <VRTK_ControllerTooltips>();
            rightToggling = rightController.GetComponent <Tooltips>();
            leftToggling  = leftController.GetComponent <Tooltips>();

            leftTooltips.ToggleTips(false);
            rightTooltips.ToggleTips(false);

            currentTutorialState = TutorialState.NONE;

            instruction = GameObject.Find("InstructionCanvas/InstructionText").GetComponent <Text>();

            StartCoroutine(TutorialCoroutine());
        }
예제 #17
0
        void Awake()
        {
            ToolsArray     = new GameObject[6];
            ToolsArray [0] = GameObject.FindGameObjectWithTag("sculpt");
            ToolsArray [1] = GameObject.FindGameObjectWithTag("scale");
            ToolsArray [2] = GameObject.FindGameObjectWithTag("rotate");
            ToolsArray [3] = GameObject.FindGameObjectWithTag("Crease");
            ToolsArray [4] = GameObject.FindGameObjectWithTag("smooth");
            ToolsArray [5] = GameObject.FindGameObjectWithTag("paint");
            grab           = GameObject.FindGameObjectWithTag("grab");
            symmetry       = GameObject.FindGameObjectWithTag("symmetry");
            CreaseStrength = ToolsArray [3].GetComponentInChildren <Slider> ();

            foreach (GameObject tools in ToolsArray)
            {
                tools.SetActive(false);
            }
            PMD  = GameObject.FindGameObjectWithTag("PMD").GetComponent <PaintMeshDeformer>();
            VRTP = GameObject.FindGameObjectWithTag("TP").GetComponent <VRTexturePainter> ();

            tooltip = GameObject.FindGameObjectWithTag("tooltip").GetComponent <VRTK_ControllerTooltips> ();
        }
예제 #18
0
    /// <summary>
    /// Set up event listeners from Controller and Pointer
    /// <returns></returns>
    ///
    void Awake()
    {
        //VRTK_ControllerEvents controller;

        //Set up event listeners
        pointer = GetComponent <VRTK_Pointer>();
        pointer.DestinationMarkerEnter += Pointer_DestinationMarkerEnter;
        pointer.DestinationMarkerExit  += Pointer_DestinationMarkerExit;

        controller = GetComponent <VRTK_ControllerEvents>();
        controller.TriggerPressed      += Controller_TriggerPressed;
        controller.TriggerReleased     += Controller_TriggerReleased;
        controller.TouchpadAxisChanged += Controller_TouchpadAxisChanged;
        controller.TouchpadReleased    += Controller_TouchpadReleased;
        controller.TouchpadPressed     += Controller_TouchpadPressed;
        controller.GripClicked         += Controller_GripClicked;

        lineRenderer                 = gameObject.AddComponent <LineRenderer>();
        lineRenderer.material        = new Material(Shader.Find("Sprites/Default"));
        lineRenderer.widthMultiplier = 0.02f;
        lineRenderer.positionCount   = 2;
        bundle  = true;
        sizeRay = 1;
        lineRenderer.material.color = Color.green;


        helpTooltip = gameObject.transform.GetChild(0).GetComponent <VRTK_ControllerTooltips>();
        helpTooltip.ToggleTips(false);


        dataToolTip = gameObject.transform.GetChild(1).GetComponent <VRTK_ControllerTooltips>();
        dataToolTip.ToggleTips(false);


        //Anonymous function to Update the dataToolTip text.
        changeText = delegate(string x) {
            dataToolTip.UpdateText(VRTK_ControllerTooltips.TooltipButtons.TouchpadTooltip, x);
        };
    }
예제 #19
0
        void Awake()
        {
            // NB: This CANNOT be static! (Each function can operate on exactly one controller)
            funcs = new Dictionary <Type, IHandFunction> {
                [typeof(CameraFunction)]      = new CameraFunction(),
                [typeof(FlyFunction)]         = new FlyFunction(),
                [typeof(GrabFunction)]        = new GrabFunction(),
                [typeof(MeasureFunction)]     = new MeasureFunction(),
                [typeof(ModeControlFunction)] = new ModeControlFunction(this),
                [typeof(ModeMenuFunction)]    = new ModeMenuFunction(this),
                [typeof(OrientFunction)]      = new OrientFunction(),
                [typeof(PointFunction)]       = new PointFunction(),
                [typeof(TeleportFunction)]    = new TeleportFunction(),
            };

            activeFuncs     = new HashSet <Type>();
            events          = GetComponent <VRTK_ControllerEvents>();
            tooltips        = GetComponentInChildren <VRTK_ControllerTooltips>();
            currPrimaryMode = currGripMode = 0;

            tooltips.SendMessage("Awake"); // This is super dumb but it prevents an exception from being thrown

            SetEnabled();
        }
        private void Start()
        {
            if (GetComponent<VRTK_ControllerEvents>() == null)
            {
                Debug.LogError("VRTK_ControllerEvents_ListenerExample is required to be attached to a Controller that has the VRTK_ControllerEvents script attached to it");
                return;
            }

            events = GetComponent<VRTK_ControllerEvents>();
            actions = GetComponent<VRTK_ControllerActions>();
            tooltips = GetComponentInChildren<VRTK_ControllerTooltips>();

            //Setup controller event listeners
            events.TriggerPressed += new ControllerInteractionEventHandler(DoTriggerPressed);
            events.TriggerReleased += new ControllerInteractionEventHandler(DoTriggerReleased);

            events.ApplicationMenuPressed += new ControllerInteractionEventHandler(DoApplicationMenuPressed);
            events.ApplicationMenuReleased += new ControllerInteractionEventHandler(DoApplicationMenuReleased);

            events.GripPressed += new ControllerInteractionEventHandler(DoGripPressed);
            events.GripReleased += new ControllerInteractionEventHandler(DoGripReleased);

            events.TouchpadPressed += new ControllerInteractionEventHandler(DoTouchpadPressed);
            events.TouchpadReleased += new ControllerInteractionEventHandler(DoTouchpadReleased);

            tooltips.ToggleTips(false);
        }
 /// <summary>
 /// Observable ControllerTooltipOff event
 /// </summary>
 /// <param name="events"></param>
 /// <returns></returns>
 public static IObservable <ControllerTooltipsEventArgs> ControllerTooltipOffAsObservable(this VRTK_ControllerTooltips events)
 {
     return(Observable.FromEvent <ControllerTooltipsEventHandler, ControllerTooltipsEventArgs>(
                h => (s, e) => h(e),
                h => events.ControllerTooltipOff += h,
                h => events.ControllerTooltipOff -= h));
 }
예제 #22
0
        // Update is called once per frame
        void FixedUpdate()
        {
            try{
                RaycastHit tooltipRayCast;
                //tooltip to show the player where the buttons are located on the controller
                if (Physics.Raycast(Raypoint.position, Raypoint.forward, out tooltipRayCast, 100f))
                {
                    if (tooltipRayCast.collider.tag == "UI" && !tooltipUIIsActive)
                    {
                        //tooltip.touchpadText = "Touchpad";
                        tooltip.UpdateText(VRTK_ControllerTooltips.TooltipButtons.TouchpadTooltip, "Press Touchpad");
                        tooltip.UpdateText(VRTK_ControllerTooltips.TooltipButtons.TriggerTooltip, "");

                        if (tooltip == null)
                        {
                            tooltip = GameObject.FindGameObjectWithTag("tooltip").GetComponent <VRTK_ControllerTooltips> ();
                        }
                        //tooltip.triggerText = "";
                        tooltipUIIsActive  = true;
                        tooltipMESHsActive = false;
                        //tooltip.touchpadText = "Touchpad";
                        //Debug.Log("tag is UI = " + tooltip.touchpadText);
                    }
                    else if (tooltipRayCast.collider.tag == "Mesh" && !tooltipMESHsActive && UIN.isActive)
                    {
                        tooltip.UpdateText(VRTK_ControllerTooltips.TooltipButtons.TriggerTooltip, "Press Trigger");
                        tooltip.UpdateText(VRTK_ControllerTooltips.TooltipButtons.TouchpadTooltip, "");

                        if (tooltip == null)
                        {
                            tooltip = GameObject.FindGameObjectWithTag("tooltip").GetComponent <VRTK_ControllerTooltips> ();
                        }
                        //tooltip.touchpadText = "";
                        tooltipMESHsActive = true;
                        tooltipUIIsActive  = false;
                        //tooltip.triggerText = "Trigger";
                        //Debug.Log("tag is UI = " + tooltip.triggerText);
                        //Debug.Log("tag is Mesh");
                    }
                    else if (tooltipRayCast.collider.tag != "UI")
                    {
                        tooltip.UpdateText(VRTK_ControllerTooltips.TooltipButtons.TouchpadTooltip, "");
                        tooltipUIIsActive = false;
                    }
                }

                //manages which tool is being used
                //using an enum
                switch (currentTool)
                {
                //if sculpt is pressed, this finds the collider with a mesh tag. and
                //gets the meshfilter so it can be modified.
                case Tools.Sculpt:
                    try
                    {
                        hit = point.pointerRenderer.GetDestinationHit();
                        if (hit.transform.gameObject.tag != "Non-Modifiable")
                        {
                            //Debug.Log(hit.collider.name);
                            filter = hit.collider.GetComponent <MeshFilter>();
                            if (filter)
                            {
                                if (filter != unappliedMesh)
                                {
                                    ApplyMeshCollider();
                                    unappliedMesh = filter;
                                }
                                //Mesh Symmetry. simple but it works
                                Vector3 relativePoint = filter.transform.InverseTransformPoint(hit.point);
                                Vector3 inversePoint  = relativePoint;
                                inversePoint.x = -relativePoint.x;
                                if (isTriggerOn)
                                {
                                    //Debug.Log("is trigger on? " + isTriggerOn);
                                    DeformMesh(filter.mesh, relativePoint, pull * Time.deltaTime, radius);
                                    if (MeshSymmetryToggle.isOn)
                                    {
                                        DeformMesh(filter.mesh, inversePoint, pull * Time.deltaTime, radius);
                                    }
                                }
                            }
                        }
                    }
                    catch (System.NullReferenceException) { }
                    break;

                case Tools.Scale:
                    try{
                        if (MeshTransform == null)
                        {
                            MeshTransform = GameObject.FindGameObjectWithTag("Mesh").GetComponent <GetMeshTransform> ();
                        }
                        //Debug.Log("Scaling");
                        MeshTransform.Scale();
                    }catch (Exception ex) {
                        if (ex is NullReferenceException || ex is UnassignedReferenceException)
                        {
                            return;
                        }
                    }
                    break;

                case Tools.Rotate:
                    try{
                        if (MeshTransform == null)
                        {
                            MeshTransform = GameObject.FindGameObjectWithTag("Mesh").GetComponent <GetMeshTransform> ();
                        }
                        //Debug.Log("Rotating");
                        MeshTransform.Rotate();
                    }catch (Exception ex) {
                        if (ex is NullReferenceException || ex is UnassignedReferenceException)
                        {
                            return;
                        }
                    }
                    break;

                case Tools.Crease:

                    try
                    {
                        if (UIN == null)
                        {
                            UIN = GameObject.FindGameObjectWithTag("UINref").GetComponent <UINavigationSystem> ();
                        }
                        AddorSubtract.value = 1;
                        pull   = -UIN.CreaseStrength.value;
                        radius = .03f;


                        hit = point.pointerRenderer.GetDestinationHit();
                        if (hit.transform.gameObject.tag != "Non-Modifiable")
                        {
                            filter = hit.collider.GetComponent <MeshFilter>();
                            if (filter)
                            {
                                if (filter != unappliedMesh)
                                {
                                    ApplyMeshCollider();
                                    unappliedMesh = filter;
                                }
                                //Mesh Symmetry. simple but it works
                                Vector3 relativePoint = filter.transform.InverseTransformPoint(hit.point);
                                Vector3 inversePoint  = relativePoint;
                                inversePoint.x = -relativePoint.x;
                                if (isTriggerOn)
                                {
                                    //Debug.Log("trigger on");
                                    DeformMesh(filter.mesh, relativePoint, pull * Time.deltaTime, radius);
                                    //filter.gameObject.GetComponent<MeshCollider> ().sharedMesh = filter.mesh;
                                    if (MeshSymmetryToggle.isOn)
                                    {
                                        radius = .03f;
                                        //Debug.Log(pull + " pull value");
                                        DeformMesh(filter.mesh, inversePoint, pull * Time.deltaTime, radius);
                                        //filter.gameObject.GetComponent<MeshCollider> ().sharedMesh = filter.mesh;
                                    }
                                }
                            }
                        }
                    }
                    catch (System.NullReferenceException) { }

                    break;         //get out

                case Tools.Grab:
                    try{
                        if (MeshTransform == null)
                        {
                            MeshTransform = GameObject.FindGameObjectWithTag("Mesh").GetComponent <GetMeshTransform> ();
                        }
                        //if (GrabToggle.isOn) {
                        MeshTransform.Grab();

                        //Debug.Log("Moving");
                    }catch (Exception ex) {
                        if (ex is NullReferenceException || ex is UnassignedReferenceException)
                        {
                            return;
                        }
                    }

                    break;

                case Tools.Symmetry:
                    try{
                        //MeshSymmetryToggle.isOn = true;
                    }catch (Exception ex) {
                        if (ex is NullReferenceException || ex is UnassignedReferenceException)
                        {
                            return;
                        }
                    }
                    break;

                case Tools.Smooth:
                    //Debug.Log("Moving");

                    try{
                        isInSmoothPage = true;
                        if (dm == null)
                        {
                            dm.ClayMesh = ClayMesh.GetComponent <MeshFilter>();
                            dm          = GameObject.FindGameObjectWithTag("Mesh").GetComponent <VRSmooth> ();
                        }
                    }catch (Exception ex) {
                        if (ex is NullReferenceException || ex is UnassignedReferenceException)
                        {
                            return;
                        }
                    }

                    break;

                case Tools.Paint:
                    //Debug.Log("paint ON");
                    try{
                        if (texpaint == null)
                        {
                            texpaint = GameObject.FindGameObjectWithTag("TP").GetComponent <VRTexturePainter> ();
                        }
                        texpaint.enabled = true;
                    }catch (Exception ex) {
                        if (ex is NullReferenceException || ex is UnassignedReferenceException)
                        {
                            return;
                        }
                    }
                    break;
                }
            }catch (Exception ex) {
                if (ex is NullReferenceException || ex is UnassignedReferenceException)
                {
                    return;
                }
            }
        }
예제 #23
0
 void Awake()
 {
     tooltip = GameObject.FindGameObjectWithTag("tooltip").GetComponent <VRTK_ControllerTooltips> ();
     //tooltip.touchpadText = "Touchpad";
     UIN = GameObject.FindGameObjectWithTag("UINref").GetComponent <UINavigationSystem>();
 }
예제 #24
0
 private void Unhighlight(VRTK_ControllerTooltips h)
 {
     h.UpdateText(tooltipButton, "");
 }
예제 #25
0
 private void Highlight(VRTK_ControllerTooltips h)
 {
     h.UpdateText(tooltipButton, text);
 }