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

Controllers in demo scene #6

Open
ChristophHaag opened this issue Feb 4, 2018 · 3 comments
Open

Controllers in demo scene #6

ChristophHaag opened this issue Feb 4, 2018 · 3 comments

Comments

@ChristophHaag
Copy link

Valve has recently completely overhauled their controller system so I thought godot_openhmd could be a good testcase / demo showcase until I update my stuff.

It seems there is some gdnative code to communicate with controllers, but there's nothing in the demo scene using it. Since there are no rendermodels provided by OpenHMD yet (there will be), for the time being some primitive shape would suffice.

@BastiaanOlij
Copy link
Member

What I usually do is just grab the models from the OpenVR installation itself. They're just .OBJ files that Godot can read fully. Not sure of the legality of using OpenVR models for OpenHMD but for demo purposes.... :)

I have to find time to get back into the OpenHMD stuff and get them compiled properly and continue working on it. The end goal is to use our own models, maybe model some hands instead of vive wands as that looks nicer in game anyway. But there are only so many hours in the day :)

@ChristophHaag
Copy link
Author

For now I'm using a meson build file that just uses all system libraries and I also had to add an ohmd context update or I didn't get any actual updates. https://github.com/ChristophHaag/godot_openhmd/commits/master

I mean I could probably write the script to connect a controller node to the openhmd controllers, but it's not super obvious how, so it would need some effort...

@BastiaanOlij
Copy link
Member

@ChristophHaag sorry for the late reply.

I haven't been able to test any of this with OpenHMD not having controllers I've managed to get to work with it but this commented out code should result in the link up when uncommenting (provided you supply the correct device ids):
https://github.com/GodotVR/godot_openhmd/blob/master/demo/Main.gd#L19

It tells the openhmd driver to use that device as a controller and automatically maps it to a positional tracker in Godot. From memory, the first controller identified as the left hand controller gets positional tracker #1, the first controller identified as the right hand controller gets positional tracker #2, and anything else picks the first free entry from tracker #3 onwards.

When you add an ARVRController node to your scene you simply set the controller ID to the correct positional tracker id and the controller node will automatically be positioned at the location of your controller.

Obviously never having tested the code properly I don't know if anything is missing to make it work but I think Joey had it all working so I'm assuming it works :)

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

No branches or pull requests

2 participants