Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Mouse Input

AechDub edited this page May 21, 2018 · 4 revisions

The mouse input control allows you to receive over video mouse events.

Mouse Click

If you want to get click events, you can write something such as the following:

        {
            if (Physics.Raycast(Camera.main.ScreenPointToRay(MixerInteractive.MousePosition), out hit, 100))
            {
                target = hit.point;
            }
        }

Mouse Move

If you want to get mouse move events, you can write something such as the following:

        transform.position = Vector3.MoveTowards(transform.position, target, step);
        RaycastHit hit;

        if (Physics.Raycast(Camera.main.ScreenPointToRay(MixerInteractive.MousePosition), out hit, 100))
        {
            target = hit.point;
        }

Alternatively, you can listen directly to the coordinates change event like so:

...

    private void MixerInteractive_OnInteractiveCoordinatesChangedEvent(object sender, Microsoft.Mixer.InteractiveCoordinatesChangedEventArgs e)
    {
        string viewName = e.Participant.UserName;
        RaycastHit hit;

        if (Physics.Raycast(Camera.main.ScreenPointToRay(e.Position), out hit, 100))
        {
            Debug.Log("HitPoint " + hit);
        }
    }
Clone this wiki locally