VR Development Framework
v 1.0.0
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
void AVR.UI.AVR_UIInteractionProvider.Update ( )
inlineprivate

Definition at line 117 of file AVR_UIInteractionProvider.cs.

117  {
118 #if AVR_NET
119  if (IsOnline && !IsOwner) return;
120 #endif
121  // Here we show/hide the UIRay if needed and also set the length of the ray to the distance to the canvas.
122  if(AVR_Canvas.active_canvases?.Count>0) {
123  float min_dist = float.PositiveInfinity;
124  AVR_Canvas closest_canv = AVR_Canvas.active_canvases[0];
125 
126  foreach(AVR_Canvas canv in AVR_Canvas.active_canvases) {
127  if(canv.isInteractible && canv.GetPlane().Raycast(new Ray(UIRay.UICamera.transform.position, UIRay.UICamera.transform.forward), out float dist)) {
128  min_dist = Mathf.Min(dist, min_dist);
129  closest_canv = canv;
130  }
131  }
132  UIRay.max_length = min_dist;
133  UIRay.canvasNormal = -closest_canv.transform.forward;
134  UIRay.show();
135  }
136  else {
137  UIRay.max_length = 30;
138  if (show_ray_only_on_hover) UIRay.hide();
139  }
140  }
bool show_ray_only_on_hover
Only show UIRay when hovering over a canvas or always.
AVR_UIRay UIRay
Pointer ray of this interactionprovider. Is required for the interactionprovider to work...
Camera UICamera
Camera that is the eventCamera for the underlying inputsystem. If left blank, a Camera with preset va...
Definition: AVR_UIRay.cs:18