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

[LINUX?] Controller button release event firing constantly & axis not working #2

Closed
beniwtv opened this issue Oct 14, 2017 · 10 comments

Comments

@beniwtv
Copy link
Collaborator

beniwtv commented Oct 14, 2017

Played around with this for a bit - great work so far!

I'm not sure if this is a bug specific to Linux (if so that bug might be in OpenVR):

  • Button press event is working (allthough firing 3 times in a row or so)
  • Button release event is not working (and firing constantly for button 0)
  • Axis always return 0 (and the trigger code from the demo doesn't move the in-game controller)

This is on an HTC Vive with two vive controllers.

@BastiaanOlij
Copy link
Member

Hey Ben,

Thanks for testing. I did do some changes yesterday and just realised I haven't commited them yet. I'll do that in the morning. I don't have controllers atm so its very possible I made a mistake. I did order some touch controllers yesterday so once they are in I can test myself :)

just have a look if you can see anything out of whack here:
https://github.com/BastiaanOlij/godot_openvr/blob/master/src/godot_openvr.cpp#L450

But note that code is about to change :)

@BastiaanOlij
Copy link
Member

I don't know if you had any more time to look at things but I did commit those changes I talked about. Whether they make any difference, no idea.

fingers cross my controllers should be arriving today and I can debug this

@beniwtv
Copy link
Collaborator Author

beniwtv commented Oct 18, 2017

I didn't have time yet - but hopefully this evening I can test it.

@BastiaanOlij
Copy link
Member

I haven't tested the button events yet but the axis are working for me on my touch controllers. The mapping is really weird though.

I think on the vive the trigger will probably be axis 4, not 2. I loop through 4 of the 5 axis and each has an x and y component, so x on axis 1, becomes axis 1 in Godot,
y on axis 1 becomes axis 2,
x on axis 2 becomes axis 3,
y on axis 2 becomes axis 4,
Etc.

Since the second axis on a vive controller is a trigger it only has a y which would become axis 4.

I might need to add in some more smarts and do some sort of axis mapping..

@beniwtv
Copy link
Collaborator Author

beniwtv commented Oct 18, 2017

Yep, can confirm axis work now - but as you said, they're mapped weirdly.
Button situation still the same tough.

@BastiaanOlij
Copy link
Member

I think this is our problem:
https://github.com/BastiaanOlij/godot/blob/master/scene/3d/arvr_nodes.cpp#L207

Should be:
bool was_pressed = (button_states & mask) == mask;

I'll try it tonight

@BastiaanOlij
Copy link
Member

This seems to fix it:

godotengine/godot#12230

@beniwtv
Copy link
Collaborator Author

beniwtv commented Oct 19, 2017

Yep, that fixes it for me too.

I thought a bit about the axis mapping issue, what do you think about using an approach similar to Godot's controller mappings?

https://github.com/godotengine/godot/blob/5303efb2fabd668bef18b7ac7606426692e5d6bb/main/input_default.cpp#L529

This way we could have the buttons and axis a bit standardized, and easily add new mappings. Not sure how "similar" VR controllers are though...

@BastiaanOlij
Copy link
Member

@beniwtv where you still testing this on linux? I'm planning on putting a package together this weekend, it would be nice to confirm if the linux build is now working and maybe include a build in it as well.

Btw, I don't know if you hang out on IRC/Matrix but we created a channel on freenode + room on matrix: #godotengine-vr

@beniwtv
Copy link
Collaborator Author

beniwtv commented Nov 2, 2017

Yep, was planning on testing the rumble PR sometime this weekend. As far as this issue - apart from the weird axis mapping, things work now.

Will look into Matrix (have been wanting to test it anyway).

@beniwtv beniwtv closed this as completed Nov 2, 2017
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