Question by 
               robinspots · Jun 15, 2020 at 02:14 PM · 
                collisionuiguivr  
              
 
              How can I create a VR world space touch-screen input system?
I understand that it should be possible to extend the StandaloneInputModule and BaseInput classes in order to create a world space touch screen interface and I've managed to get this far:
 public class VRTouchBaseInput : BaseInput
 {
     public Vector2 CursorPosition = Vector2.zero;
     public bool IsPressed = false;
  
     public override Vector2 mousePosition
     {
         get { return this.CursorPosition; }
     }
 
     public override bool GetMouseButtonDown(int button)
     {
         return IsPressed;
     }
     
     public override bool mousePresent
     {
         get { return true; }
     }
 }
 public class VRTouchStandaloneInput : StandaloneInputModule
 {
     protected override void Start()
     {
         this.inputOverride = GetComponent<VRTouchBaseInput>();
         base.Start();
     }
 }
On my canvas UI I'm then able to add the following code, which detects when a controller interacts/collides with the collider on the UI canvas and updates the cursor accordingly:
 private void OnCollisionEnter(Collision other)
     {
         _touchBaseInput.CursorPosition = other.contacts[0].point;
         _touchBaseInput.IsPressed = true;
     }
 
     private void OnCollisionExit(Collision other)
     {
         _touchBaseInput.IsPressed = false;
     }
The cursor updates correctly, however, I can't seem to get register presses on any of my UI elements.
Is there something additional I need to do here?
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                