Configuring Xbox button mapping

32 views
Skip to first unread message

Eric W

unread,
Jul 6, 2015, 4:11:16 PM7/6/15
to omeg...@googlegroups.com
How do I config what the buttons on the controller do?

For example, I noticed that when I run pointCloud using the Xbox controller (without freefly).  I can move forward, back, strafe left, strafe right, rotate left, rotate right and I can only move up and down if I use the left trigger with the right stick.  But in this mode, I can't rotate up or rotate down.

If I use the freefly mode, I can move forward, back, strafe left, strafe right, rotate left, rotate right, rotate up and rotate down.  But I noticed that in this mode using the left trigger will move up, but I can't move down.

Alessandro Febretti

unread,
Jul 7, 2015, 6:58:20 PM7/7/15
to omeg...@googlegroups.com
Hi Eric,
I pused an update to the omegalib binary that contains a new controller mapping done by a collaborator, that should work for freefly. Please give it a try and see if it works better for you.

Eric W

unread,
Jul 9, 2015, 3:35:48 PM7/9/15
to omeg...@googlegroups.com
Do I just use the package manager to download the new update?

Eric

Alessandro Febretti

unread,
Jul 9, 2015, 3:48:00 PM7/9/15
to omeg...@googlegroups.com
yup, run package manager and choose update packages

Eric W

unread,
Jul 9, 2015, 4:37:34 PM7/9/15
to omeg...@googlegroups.com
Will do. Just curious though, if I wanted to remap the controller myself would that involve messing with the C++ files and building from source?

Alessandro Febretti

unread,
Jul 9, 2015, 4:47:47 PM7/9/15
to omeg...@googlegroups.com
Sadly right now yes, buttons mappings for the camera controller are hard-coded in C++ (see here https://github.com/uic-evl/omegalib/blob/master/src/omega/GamepadCameraController.cpp#L60). This is something I want to change and it would be pretty easy to read those button names from a config file,
but I never had the time to get back to it.

An alternative if you want full control without tinkering with the C++ code is to write your own camera controller in python, Like here: https://github.com/tmarrinan/orbitNavigation

This of course means writing more code, but you have full control on how the camera is controlled.

Eric W

unread,
Jul 9, 2015, 6:38:32 PM7/9/15
to omeg...@googlegroups.com
Thanks, the new controls for freefly mode works great.

But I noticed that for the non-freefly mode, I have lost the ability to move up and down when I hold down the left trigger and use the right stick.

Alessandro Febretti

unread,
Jul 10, 2015, 11:30:17 AM7/10/15
to omeg...@googlegroups.com
umm we might need to merge some of the old code with the new... I'll put this in my todo list. Hopefuly I'll be able to get back at this in the next few days.

Eric W

unread,
Jul 20, 2015, 9:50:05 PM7/20/15
to omeg...@googlegroups.com
Is there anyway to use the right bumper and the right trigger?  I tested out all of the event flags listed under the wiki and it seems that these 2 buttons aren't mapped.

Alessandro Febretti

unread,
Jul 23, 2015, 4:30:30 PM7/23/15
to omegalib, eric....@gmail.com
Right shoulder button / Trigger are mapped to buttons 8 and 9

You are right, those buttons are missing from the python mappings, but you can just use their numeric codes instead for now (if you are on python, in C++ you can use the button names)
Use 1<<15 for Button 8 (Right Shoulder button)
And 1<<16 for Button9 (Right Trigger Button)

Eric W

unread,
Jul 29, 2015, 6:28:54 PM7/29/15
to omegalib, feb...@gmail.com
I am trying to use this in a line of code that looks like this:

if event.isButtonDown(EventFlags.Button6):

If I am trying to use the Right Shoulder button, where would the 1<<15 go?

Alessandro Febretti

unread,
Jul 29, 2015, 6:35:55 PM7/29/15
to omegalib, eric....@gmail.com
if event.isButtonDown(1<<15):


Eric W

unread,
Jul 29, 2015, 6:40:11 PM7/29/15
to omegalib, feb...@gmail.com
I tried that and I have the errors:

PYTHON ERROR!!! Traceback (most recent call last):
File "molecule\molecule.py", line 229 in onEvent
Boost.Python.ArgumentError: Python argument types in
Event.isButtonDown(Event, int) did not match C++ signature:
isButtonDown(class omicron:: Event (lvalue), enum omicron::EventBase::Flags)

Alessandro Febretti

unread,
Jul 29, 2015, 6:45:47 PM7/29/15
to omegalib, eric....@gmail.com
ack sorry, that does not work because isButtonDown expects an EventFlag type, so you can't enter custom values. You need to use the isFlagSet method instead:
if event.getType() == EventType::Down and event.isFlagSet(1<<15):

Eric W

unread,
Jul 29, 2015, 7:41:22 PM7/29/15
to omegalib, feb...@gmail.com
I have an Invalid Syntax error with the EventType::Down

Alessandro Febretti

unread,
Jul 29, 2015, 7:43:13 PM7/29/15
to omegalib, eric....@gmail.com
It's EventType.Down. 
Reply all
Reply to author
Forward
0 new messages