Beispiel #1
0
    protected virtual void OnEnable()
    {
        highlighter = new VRTK_MaterialColorSwapHighlighter();
        highlighter.Initialise(highlightColour, gameObject);

        StartCoroutine(DoFlashing());
    }
    void OnEnable()
    {
        if (highlighterObject)
        {
            highlighterObject.InteractObjectHighlighterHighlighted += InteractObjectHighlighterHighlighted;
        }
        else
        {
            highlighter = new VRTK_MaterialColorSwapHighlighter();
            highlighter.Initialise(highlightColour, gameObject);
        }

        StartCoroutine(DoFlashing());

        if (closeness == Closeness.NearTouch)
        {
            interactableObject.InteractableObjectNearTouched += InteractableObjectNearTouched;
        }
        else if (closeness == Closeness.Touched)
        {
            interactableObject.InteractableObjectTouched += InteractableObjectNearTouched;
        }
        else
        {
            Debug.LogError("Unknown closeness value");
        }

        disableHighlight = true;
    }
Beispiel #3
0
    private void ObjectSelectedHandler(GameObject selected)
    {
        GameObject instance = Instantiate <GameObject>(selected);
        VRTK_InteractableObject          interactible = instance.AddComponent <VRTK_InteractableObject>();
        VRTK_ChildOfControllerGrabAttach primary      = instance.AddComponent <VRTK_ChildOfControllerGrabAttach>();

        interactible.grabAttachMechanicScript = primary;
        primary.precisionGrab = true;
        VRTK_PrecisionScaleAction secondary = instance.AddComponent <VRTK_PrecisionScaleAction>();

        interactible.secondaryGrabActionScript = secondary;
        VRTK_MaterialColorSwapHighlighter highlighter = selected.AddComponent <VRTK_MaterialColorSwapHighlighter>();

        highlighter.customMaterial = highlighterMaterial;

        instance.transform.localScale = Vector3.one * 0.01f;
        instance.transform.position   = transform.position;
        instance.transform.rotation   = transform.rotation;
    }