Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to use index fingers to type instead of mallets #17

Open
lux opened this issue Oct 19, 2018 · 7 comments
Open

Option to use index fingers to type instead of mallets #17

lux opened this issue Oct 19, 2018 · 7 comments

Comments

@lux
Copy link
Contributor

lux commented Oct 19, 2018

No description provided.

@OptrixAU
Copy link

OptrixAU commented Aug 14, 2019

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.

@TecDesign
Copy link

TecDesign commented Oct 23, 2019

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.

@crodriguezouterelo
Copy link

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.

@lux
Copy link
Contributor Author

lux commented Apr 19, 2020

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.

@crodriguezouterelo
Copy link

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.

@jenkatan29
Copy link

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

@OptrixAU
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants