cancel
Showing results for 
Search instead for 
Did you mean: 

Use GearVrController with Selection Ray - Unity

davidbeloosesky
Explorer
Hi, I figure out how to add a GearVrController to a scene.
(Adding a OVRCameraRig, and Add GearVRController under the RightHandAnchor)
The controller follows the hand movements. 

But how can I add a selection options + a ray from the device to the scene?
I mean a ray that can select item, like in the Oculus store below:

z55w50ytmdyp.png




43 REPLIES 43

tamer_ozturk2
Explorer

Unfortunately, if no controller is connected, gaze input doesnt work with gear vr.

RayPointer.cs UpdateCastRayIfPossible() function needs to be modified to make it work.

Or

RayPointer.cs needs another if check for the active controller to fall back to;

OVRInput.Controller.TouchPad

The question is, which one and how?

oculus_gabor
Protege
Glad you guys like the sample.

@"tamer.ozturk2", you are right, that sample has no gaze fallback currently. I put it together pretty hastily for touch controllers specifically. There are also some issues with how the active controller is being tracked and a few other API pain points.

I've just finished writing a more in depth sample with fallback support for gaze, as well as a bunch of API improvements. This blog post will be updated with the new and instructions. I'll be writing the blog update on Friday, it should be live in about two weeks. I'll let you know as soon as its online!

tamer_ozturk2
Explorer


Glad you guys like the sample.

@"tamer.ozturk2", you are right, that sample has no gaze fallback currently. I put it together pretty hastily for touch controllers specifically. There are also some issues with how the active controller is being tracked and a few other API pain points.

I've just finished writing a more in depth sample with fallback support for gaze, as well as a bunch of API improvements. This blog post will be updated with the new and instructions. I'll be writing the blog update on Friday, it should be live in about two weeks. I'll let you know as soon as its online!



Thank you, could you kindly share the code for the new sample here, so we dont wait 2 weeks.

myBadStudios
Protege
I am bookmarking this page so I can get up to date info on this also.

Here's the thing: I have an asset on the asset store that is supposed to block the game from starting until after you have passed my kit. Some of my customers have asked me "Will this work in VR?" and I said "I have no idea. I never tried it" so when I got my Rift the first thing I did was see if my kit could work and after spending the 30 seconds updating the UI to work in world space I immediately noticed a HUGE stumble block that will prevent my kit from working in VR:
I am asking people to enter text into a text field and, well, for that I kinda need a keyboard... 😞

So I went and created a world space keyboard that can be skinned and customised to contain any combination of letters that the player chooses and all of this can be done in 2 lines of code and changing the background image of 1 prefab. I made that keyboard so skinnable and so customisable and so easy to use that there is nothing out there that can beat it as far as I have seen...

Only problem is... although it works great as a skinned keyboard to replace the native keyboards on mobiles etc, as soon as I go into VR I have no means of clicking that keyboard. This means I can now release this asset as a "skinnable native keyboard replacement" not the "VR Keyboard" that I intended. I want to include it as a free update to my existing kit but now I am forced to tell my customers "Here is a keyboard you can use in VR. Use this and you can now use this asset of mine in VR!!!!!! ....you just have to figure out for yourself how to actually press the buttons"

Not good 😞
This is what it is doing at the moment...

https://youtu.be/coIy2F0QJBI 

tamer_ozturk2
Explorer



Glad you guys like the sample.

@"tamer.ozturk2", you are right, that sample has no gaze fallback currently. I put it together pretty hastily for touch controllers specifically. There are also some issues with how the active controller is being tracked and a few other API pain points.

I've just finished writing a more in depth sample with fallback support for gaze, as well as a bunch of API improvements. This blog post will be updated with the new and instructions. I'll be writing the blog update on Friday, it should be live in about two weeks. I'll let you know as soon as its online!



Thank you, do you mind sharing the code as is, so we dont wait for 2 weeks? I like to read code for learning purposes anyhow.

tamer_ozturk2
Explorer



Glad you guys like the sample.

@"tamer.ozturk2", you are right, that sample has no gaze fallback currently. I put it together pretty hastily for touch controllers specifically. There are also some issues with how the active controller is being tracked and a few other API pain points.

I've just finished writing a more in depth sample with fallback support for gaze, as well as a bunch of API improvements. This blog post will be updated with the new and instructions. I'll be writing the blog update on Friday, it should be live in about two weeks. I'll let you know as soon as its online!



Thank you, do you mind sharing the code as is, so we dont wait for 2 weeks? I like to read code for learning purposes anyhow.

oculus_gabor
Protege
@"tamer.ozturk2" The code might not make a lot of sense without the documentation that is the blog post. It should be live pretty soon. Hang tight.

@myBadStudios I just took a look at your video, it's really odd that the selection ray would be so far off. There are two potential issues i could think of:

First some configuration of the visual ray might not match up with the ray actually being cast into the world (this is likely the cause).

Second, I assume the canvas that the keyboard belongs to is a world-space canvas? Is the Event Camera of the canvas set to the center eye anchor?

The code i attached to this forum post was a bit hack-y (proof of concept quality). When the blog is updated with the new code, if that code still breaks your input i'll take a closer look and help you resolve the input issue.

tamer_ozturk2
Explorer


@"tamer.ozturk2" The code might not make a lot of sense without the documentation that is the blog post. It should be live pretty soon. Hang tight.


Okay great news, sorry for the triple post by the way but the forum has its own problems as i see.

Could you atleast add swipe controls to the blog post or a new post as well?

oculus_gabor
Protege
Is there a use case for swipe that OVRInput in it's current state does not cover?

From: https://developer.oculus.com/documentation/unity/latest/concepts/unity-ovrinput/
// returns true on the frame when a user’s finger pulled off Gear VR touchpad controller on a swipe down
OVRInput.GetDown(OVRInput.Button.DpadDown);

// returns true the frame AFTER user’s finger pulled off Gear VR touchpad controller on a swipe right
OVRInput.GetUp(OVRInput.RawButton.DpadRight);

tamer_ozturk2
Explorer


Is there a use case for swipe that OVRInput in it's current state does not cover?

From: https://developer.oculus.com/documentation/unity/latest/concepts/unity-ovrinput/
// returns true on the frame when a user’s finger pulled off Gear VR touchpad controller on a swipe down
OVRInput.GetDown(OVRInput.Button.DpadDown);

// returns true the frame AFTER user’s finger pulled off Gear VR touchpad controller on a swipe right
OVRInput.GetUp(OVRInput.RawButton.DpadRight);



OVRInputModule has the following variables defined but not used anywhere, so i thought there is/was/supposed to be some swipe related code in the module when interacting with ui/non ui items.

  [Header("Touchpad Swipe Scroll")]
  [Tooltip("Enable scrolling by swiping the GearVR touchpad")]
  public bool useSwipeScroll = true;
  [Tooltip("Minimum swipe amount to trigger scrolling")]
  public float minSwipeMovement = 0;
  [Tooltip("Distance scrolled when swipe scroll occurs")]
  public float swipeScrollScale = 4f;
  #region GearVR swipe scroll
  private Vector2 swipeStartPos;
  private Vector2 unusedSwipe;
  #endregion