WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Old 06-16-2017, 09:04 AM
rdkirkden rdkirkden is offline
Join Date: May 2017
Posts: 5
Oculus Rift DK2 + gamepad controller


I’m trying to build an environment in which the subject wears an Oculus Rift DK2 headset and is additionally able to navigate using a gamepad controller (Logitech Dual Action). The controller should allow the subject to move along both horizontal axes using the left handle and also turn (i.e. rotate about the vertical axis) using the right handle.

The problem I have encountered is that when the subject turns using the controller, the horizontal axes are not re-aligned to the subject’s new orientation, with the consequence that after a 90 degree turn, the left/right handle action that previously caused movement along the x-axis now causes movement along the y-axis.

In an attempt to narrow down the cause of the problem, I started with the ‘’ example script (, which gives complete gamepad control over a view on the monitor, but does not incorporate a headset. To this, I added code from the ‘’ script (Program Files\WorldViz\Vizard5.2\examples\devices\, cited in, which incorporates an Oculus Rift DK2 headset, but has only limited keyboard controls (to move along the horizontal axes, but no turning). The problem emerged as soon as I instructed the headset sensor to link with the ‘MainView’. I attach two code listings: in the first, there is still full gamepad control but no headset control over the view because the link has not yet been made; in the second, the headset has been linked in and is working properly, but the problem with gamepad control has emerged.

You can see that in addition to adding the headset instructions, I’ve also made a few changes to the gamepad control code in the ‘UpdateJoystick’ function. This was necessary to get as much functionality as I could from the gamepad and headset, leaving just the problem with turning that I could not solve. The changes that I succeeded in making were as follows.

1) The ‘viz.MainView.move’ statement didn’t work at all after linking the Oculus sensor, so the gamepad could not be used to move along the horizontal axes. This was solved by using a ‘navigationNode.setPosition’ statement instead. I’ve noticed that the ‘’ script similarly uses ‘navigationNode.setPosition’ to get its keyboard controls working, although I don’t understand why this is necessary. (In contrast, the ‘viz.MainView.setEuler’ statement worked fine, so the gamepad could be used to rotate the view. Note that I’m using the ‘z’ variable here, not the ‘twist’ variable, because the Device Calibration Wizard got the horizontal and vertical actions of the right handle mixed up.)

2) After changing this, the gamepad could be used to move along the horizontal axes, but when the subject turned their head the horizontal axes were not re-aligned to the subject’s new orientation. To solve this, I had to incorporate the subject’s current yaw value into the ‘navigationNode.setPosition’ statement, using code that I do not understand, but copied from the keyboard controls in the ‘’ script.

To clarify my present situation, the horizontal axes are now being re-aligned when the headset turns, but not when the view is rotated using the right gamepad handle.

I’ve tried everything I can think of to get his working, but with no success. A large part of the problem is that I don’t understand all of the code, because the documentation in the Vizard 5 Reference is not very detailed.

I should add that I’m using Vizard 5.2 and Oculus SDK 0.5. Before attempting to write code and test any specific functionality, I was advised on this forum to update to the latest versions of both Vizard and Oculus; but I’m reluctant to do this unless I’m certain it is necessary, just in case it causes problems for some other hardware that I may need to use (some old NVIDIA 3D VISION 2 glasses). The two example scripts mentioned above each works perfectly on my system, it’s just that I can’t quite get them to fit together.

Any advice appreciated!

Attached Files
File Type: txt before_linking_headset.txt (853 Bytes, 9 views)
File Type: txt after_linking_headset.txt (1.2 KB, 8 views)
Reply With Quote
Old 06-23-2017, 09:22 AM
rdkirkden rdkirkden is offline
Join Date: May 2017
Posts: 5
Problem largely solved

Well, I found a solution in a related thread: This involved using the Vizconnect utility to configure the behaviour of my hardware (HMD, tracker and gamepad) for me. Even this was not straightforward, as the documentation in Vizard is so poor. I found the easiest way was to use the wizard (option 2 on the startup page) to set up a basic configuration and then modify a few settings in the advanced configuration menu (option 3). In particular, I had to decrease the ‘rotation acceleration’, ‘max rotation speed’ and ‘rotation auto breaking drag coeff’ in the ‘Transports’ settings to prevent a feeling of nausea when using the gamepad to rotate the view.

Vizconnect proved to be great for getting my hardware devices to interact correctly with one another, but I found that it presented some difficulties when it came to accessing and controlling objects in the script. This is because it created a number of objects (handles and links and so on for my devices and for an avatar) which it was not obvious how to reference; and also because some basic methods of ‘viz’ and ‘viz.MainWindow’ would no longer work.

In case anybody else is following this thread and has not used Vizconnect before, I’ll mention a couple of issues that I managed to solve either by stumbling across nuggets buried in the Vizard documentation or elsewhere, or by examining the Vizconnect configuration file script, or by trial and error.

1) To get rid of the disembodied gloved hand that vizconnect insists on displaying: ‘vizconnect.getAvatar().getNode3d().visible( viz.OFF )’. (Warning: do not delete the glove because there’s a hideous zombie hand underneath!!)

2) To set the avatar’s initial viewpoint in the environment (normally achieved using ‘room = viz.addChild(‘name’)’ and ‘room.setPosition([x,y,z])’), you have to first reference the tracker’s link object (‘tracker_link = vizconnect.getTracker('head_tracker').getLink()’), then straighten out the view because vizconnect unaccountably makes it crooked (‘tracker_link.reset(viz.RESET_ORI_HEADING)’), and finally set the viewpoint you want using ‘postTrans’ (e.g. tracker_link.postTrans([0,1.8,-8])’).

3) Collision control can’t be set up using the normal ‘viz.collision(viz.ON)’ command because vizconnect prevents this from working. It is also impossible to separately set the collision status of objects that are later added to the environment, although their gravity status can be set. Instead, it is necessary to set a uniform control collision for the whole environment by importing the ‘view_collision’ script that is in Vizconnect’s ‘utils’ folder. Instructions for using this script are at: But note that the version of ‘view_collision’ that comes with Vizard 5.2 doesn’t work in several respects. I ended up using the version that came with Vizard 5.5 instead, and this was fine in most respects, except that it causes the avatar to bounce off some objects in the environment (though not the walls) with quite a judder. This last issue is the only thing I’ve not been able resolve (I haven’t needed to yet as in the environment I’m working on the objects are all low enough that the avatar can float over them – it’s the walls that I wanted to make collision-proof).
Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Which Vizard5 version to use with Oculus Rift DK2? rdkirkden Vizard 3 06-16-2017 08:33 AM
Oculus Rift + Vizard help required sukhpreet Vizard 1 01-03-2017 11:52 AM
Xbox controller and Oculus DK2 prilpi Vizard 17 03-28-2016 05:00 AM
Oculus Rift and 360 Panorama with Vizard Lite Edition mshukun Vizard 4 11-10-2015 12:17 PM
Multiple post-process effects with oculus rift lklab Vizard 2 03-13-2015 01:48 PM

All times are GMT -7. The time now is 06:47 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2002-2014 WorldViz LLC