User avatar
PeterO
Posts: 4182
Joined: Sun Jul 22, 2012 4:14 pm

3D navigatoin with game controller

Tue May 08, 2018 12:19 pm

Does anyone have any tips/wisdom/experience/links to good tutorials about using game controllers to navigate a 3D scene ?

I've restarted work on the code shown running in this video:
https://www.youtube.com/watch?v=3zezUiJ8NI8

That version used a track-ball and meta-keys for 3D navigation, but now I have a wireless game controller so I though I would try to use that instead for he 3D navigation. I have the basics working (Pan/Tilt on one stick. Move forwards/backwards and left/right on the other), but to be honest it's not working as well as I hoped. The old track-ball version seems easier to use (maybe only because I'm used to it ;) )

My biggest problem is that I need to be able to accurately place items (mostly small buttons) under the set of cross-hairs so that a controller button press will press the displayed button (see video for examples) but It seems much easier to do this with the track-ball that with the game controller.

Does anyone have any ideas on how to use the joystick motion/position to allow both quick motion about the scene AND accurate positioning over small items ? The controller also has the normal "rocker switch" buttons on the left and 4 press buttons on the right.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
PeterO
Posts: 4182
Joined: Sun Jul 22, 2012 4:14 pm

Re: 3D navigatoin with game controller

Thu May 10, 2018 3:06 pm

Here's my solution : "Snap to button". it took a bit of work because I had to reproduce the transformation in the vertex shader to work out where the buttons are actually rendered on the screen. This showed up some problems with my 4x4 matrix handling code. I think it was a case of two wrongs making a right as I had row/columns mixed up in two places !

Button nearest to the cross hairs cursor now turns green :-)

https://pbs.twimg.com/media/Dc2BbgMXkAAW6cw.jpg

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

Return to “Graphics programming”

Who is online

Users browsing this forum: No registered users and 2 guests