1 using System.Collections;
2 using System.Collections.Generic;
22 get {
return _currentActive; }
24 _currentActive = value;
25 VRInput.Instance.setEventCamera(value?.UIRay?.UICamera);
32 [AVR.Core.Attributes.FoldoutGroup(
"Events")]
36 [AVR.Core.Attributes.FoldoutGroup(
"Events")]
40 [AVR.Core.Attributes.FoldoutGroup(
"Events")]
47 public bool show_ray_only_on_hover =
false;
56 private float stime = 0.0f;
60 stime = Time.realtimeSinceStartup;
72 UIRay = GetComponentInChildren<AVR_UIRay>();
75 AVR_DevConsole.cerror(
"UIInteractionProvider requires an AVR_UIRay to function!",
this);
83 if (IsOnline && !IsOwner)
return;
88 if (Time.realtimeSinceStartup - stime < 1.0 && !controller.inputManager) {
94 AVR_DevConsole.warn(
"Attempted to set UIInteractionProvider \"" + gameObject.name +
"\" but another UIInteractionprovider is already active! Only one can be active at a time.");
95 currentActive.enabled =
false;
97 else if(!controller.inputManager) {
98 AVR_DevConsole.error(
"AVR_UIInteractionProvider references a controller that has no inputmanager!");
102 AVR_DevConsole.error(
"AVR_UIInteractionProvider can only be used with a VRInput component!");
105 currentActive =
this;
111 if (IsOnline && !IsOwner)
return;
114 currentActive = null;
119 if (IsOnline && !IsOwner)
return;
123 float min_dist = float.PositiveInfinity;
124 AVR_Canvas closest_canv = AVR_Canvas.active_canvases[0];
128 min_dist = Mathf.Min(dist, min_dist);
132 UIRay.max_length = min_dist;
133 UIRay.canvasNormal = -closest_canv.transform.forward;
137 UIRay.max_length = 30;
138 if (show_ray_only_on_hover) UIRay.hide();
Represents a UI pointer-ray.
NOTE: If your EventSystem object has a InputSystemUIInputModule (new Unity input system) then any set...
static List< AVR_Canvas > active_canvases
A list of all AVR_Canvases that the user is currently interacting with. NOTE: This is not the same as...
bool isInteractible
If set to false, the UIInteractionprovider will disregard this canvas entirely.
AVR_ControllerInputManager.BoolEvent mouseButton1Click
override void OnDisable()
AVR_ControllerInputManager.BoolEvent mouseButton0Down
Sets the documentation html file inside of Packages/com.avr.core/Documentation/html of a given class...
AVR_ControllerInputManager.BoolEvent mouseButton1Up
Assigns given attributes to a foldout group in the inspector. The way these are drawn is determined b...
Plane GetPlane()
Returns the 3d plane this canvas lies in
AVR_Component specifically attatched to an AVR_Controller. Needs to have an AVR_Controller on this ga...
AVR_UIRay UIRay
Pointer ray of this interactionprovider. Is required for the interactionprovider to work...
Represents a canvas for VR interaction purposes. Allows for interaction with the AVR_UIInteractionPro...
static AVR_UIInteractionProvider _currentActive
Camera UICamera
Camera that is the eventCamera for the underlying inputsystem. If left blank, a Camera with preset va...