VRKeys icon indicating copy to clipboard operation
VRKeys copied to clipboard

Option to use index fingers to type instead of mallets

Open lux opened this issue 5 years ago • 7 comments

lux avatar Oct 19 '18 15:10 lux

We've also modified the system to use our laser-pointers instead of mallets too.

You can make the keys work with almost any collider or raycast. In your OnColliderEnter or when Physics.Raycast returns true and gives you back the collider object, you...

Key HitKey = collider.GetComponent<Key>();
HitKey.HandleTriggerEnter(null);

This will work for any of the existing keyboard keys.

We keep the keyboard on a specific layer so any object our raycast hits is guaranteed to be a key, but if you're putting this in something more generic, you should double-check that HitKey is non-null before you use it - objects that aren't keys won't have the Key behaviour.

OptrixAU avatar Aug 14 '19 04:08 OptrixAU

First of all, it is great asset! the example scene works really well. Is it posible to use this asset in combination with the OVR Player Controller that comes with the Oculus Intergration package? and in addition use the keyboard with the pointer instead of the mallets?

I added the VRKeys prefab in my scene and assigned the CenterEyeAnchor and added the OVRRaycaster to the canvas, also i disabled the mallets and set the layer of all gameobjects in the prefab to UI. When i press play in the editor, the keyboard stays in position, and dont get into position relative to user (OVR CameraRig). When aming the pointer on the keys it goes right true it, it doesn't see the colliders. it does collide with canvas.

TecDesign avatar Oct 23 '19 12:10 TecDesign

We've also modified the system to use our laser-pointers instead of mallets too.

You can make the keys work with almost any collider or raycast. In your OnColliderEnter or when Physics.Raycast returns true and gives you back the collider object, you...

Key HitKey = collider.GetComponent<Key>();
HitKey.HandleTriggerEnter(null);

This will work for any of the existing keyboard keys.

We keep the keyboard on a specific layer so any object our raycast hits is guaranteed to be a key, but if you're putting this in something more generic, you should double-check that HitKey is non-null before you use it - objects that aren't keys won't have the Key behaviour.

Hello OptrixAU,

Just like TecDesign, I want to make other items interactable with the keybaord. Seeing how you managed to do so, I was wondering if you could guide me/us.

While I'm interested in the modificiations you made to make the laser-pointers work, I was wondering how I could do something similar to make my avatar hands interact with the keyboard to type on it.

Best regards and thanks in advance.

crodriguezouterelo avatar Apr 18 '20 14:04 crodriguezouterelo

To hook it up for finger use, it looks like you may be able to do this:

  1. Attach the Mallet and Controller components to the fingertips on your hand prefabs.
  2. Assign both of your hand prefabs to the Keyboard component's leftMallet and rightMallet properties in the inspector.

Those components were designed to be able to be attached to other objects than just the example mallets, and for the mallets to be replaceable with custom versions that suit your game/app's needs.

I haven't had a chance to try it out yet, and I've been hoping to find time to make some of these changes to VRKeys too, but let me know if that works and I'll try to dig in to see what else is needed if you get stuck.

lux avatar Apr 19 '20 00:04 lux

Hello lux,

Sorry for my late response (took a weak off this project of mine), and honestly thank you for yours. Unfortunately, I tried your suggestion to no avail. I think the reason lies in the first instruction: the interactable fingertips are absent until I hit "Play", at which point a component from the Oculus Framework is triggered and the script "InteractableToolsCreator", contained within the "InteractableToolsSDKDriver" prefab, is activated.

image

I have tried to attach both the Mallet and Controller to many different objects which I thought could solve the issue (that being my hands not being able to interact with the keyboard) with no success so far; have already tried attaching them to all FingerTipPokeToolFinger items (see the lower part of the previous capture).

The hand tracking elements in the scene are highlighted in the following image (their name are pretty much self-explanatory).

image

How could I attach the Mallet and Controller controllers to the fingertips if they are not present in the scene? I've got the same problem when trying the very same thing on the virtual hands emulated by the Oculus Touch controllers (which are hidden within the "LocalAvatar" prefab).

If you could guide me towards any fix, I would really appreciate it. Best regards and thanks in advance.

crodriguezouterelo avatar Apr 29 '20 00:04 crodriguezouterelo

@crodriguezouterelo did you find any other solution to this? also looking for a keyboard that i can interact with using hand tracking

jenkatan29 avatar Aug 18 '20 06:08 jenkatan29

The basic idea is to just place gameobjects with simple colliders (SphereColliders, most likely) on the tip of the object you want to use to strike the key.

Then on the object, you add a script that contains...

void OnColliderEnter(collider)
{
    Key HitKey = collider.GetComponent<Key>();
    if (HitKey != null)
        HitKey.HandleTriggerEnter(null);
}

Basically, this says "If I hit something, get the Key component of the thing I hit. If it has one, call it.".

That will press your chosen key.

OptrixAU avatar Aug 18 '20 06:08 OptrixAU