WorldViz User Forum

WorldViz User Forum (
-   Vizard (
-   -   Xbox controller and Oculus DK2 (

prilpi 03-15-2016 12:35 AM

Xbox controller and Oculus DK2
hi there,

I started doing some tests with the Oculus Rift DK2 for Architectural walk-thru..

last week I also add the xbox PC wireless controller.
separately with demos they both work fine.
however when combined the scripts - only one will work :confused:

for example, in the "maze" controller demo the OCULUS wont work.
i get no error msgs.. it just. dont work..
(the blue hdmi signal led in the oculus is on, screens OK but it doesn't respond)

i also getting some kind of conflict when use the pit (walk on the plank) demo with the oculus DK2 :
when the oculus works OK, the "faller" doesn't work. i mean.. no gravity.
when disable the oculus import script (""") and controlling the views with the keyboard it works fine..

it would be great if you can provide me the correct script for both scenes or guide me thru this..


Jeff 03-15-2016 01:01 AM

Can you attach the vizconnect config file you're using for Oculus with Xbox controller?

prilpi 03-15-2016 05:38 AM

Hi Jeff,
Thanks for your reply.
Where can i find the vizconnect config file ?

What do you think about the other issue ?
(adding the oculus import script to the Pit demo disables the "falling" -
when the floor goes down or the plank goes up it doesn't effect the eye level..)


Erikvdb 03-15-2016 08:33 AM

If you don't know where to find the vizconnect config file, you probably didn't use vizconnect ;)

Check what tracker the viz.MainView is linked to, and what things are done to that tracker. Sounds to me like the MainView is just stuck in the ground (or somewhere else outside the level) in your "maze" demo because it's not connected to the controller node, and in case of the pit demo, the PitTrackedFaller class is not applied to the correct tracker either.

prilpi 03-15-2016 09:57 PM


I'm kinda new to this so i try to catch up with you..
Thing is i dont need to import vizconnect in for the oculus or the controller to work. vizard detects them

In that case (if i understand correctly) why is the vizconnect config matters ?
Is there a vizconnect config to each scene ?

If i get it right there is a kind of conflict with the mainview link (?)
(linked to the oculus / linked to the xbox controller)

I have the feeling its a minor thing i'm missing here
I just need the oculus for the view and the controller to walk in the maze demo instead of the keypad (sounds simple..:)

Attached is the script for the controller
(i disabled the oculus) and the controller works fine.
Again, when i enables the oculus the controller doesn't respond (thou all its buttons responding..)

Guess i just need the correct script for running them both together

the script i use -
(basicly connect oculus + maze + controller):

import viz
import vizact
import vizcam
import sys
import vizinfo
import oculus

# Initialize window
# Setup Oculus Rift HMD
hmd = oculus.Rift()
if not hmd.getSensor():
sys.exit('Oculus Rift not detected')

# Setup navigation node and link to main view
navigationNode = viz.addGroup()
viewLink =,viz.MainView)

# Apply user profile eye height to view
profile = hmd.getProfile()
if profile:
# Add environment model

# Load DirectInput plug-in
dinput = viz.add('DirectInput.dle')

# Add first available joystick
joy = dinput.addJoystick()

# Set dead zone threshold so small movements of joystick are ignored

def UpdateMovement():

elapsed = viz.elapsed()

# Get the joystick position
x,y,z = joy.getPosition()

# Get the twist of the joystick
twist = joy.getTwist()

# Move the viewpoint based on xy-axis value
move_amount = 5 * elapsed
viz.MainView.move([x*move_amount,0,y*move_amount], viz.BODY_ORI)
# Turn the viewpoint left/right based on twist value
turn_amount = 90 * elapsed
viz.MainView.setEuler([twist*turn_amount,0,0], viz.BODY_ORI, viz.REL_PARENT)

vizact.ontimer(0, UpdateMovement)

Jeff 03-16-2016 12:46 AM

In the following code the Oculus sensor data is applied to the viewpoint and the viewpoint is linked to a navigation node:


# Setup navigation node and link to main view
navigationNode = viz.addGroup()
viewLink =, viz.MainView)

In your UpdateMovement function the joystick data should be used to update navigationNode rather than viz.MainView.

If you want to set this up directly through the code, I would recommend you start with the script. Then swap out the lines that check for key events with joystick events in the UpdateView function.

The Vizconnect Introduction page describes the advantages of using vizconnect. The Vizconnect Tutorials are useful for learning vizconnect. To accomplish this same task in vizconnect, parent the display to the oculus tracker and then parent the tracker to a transport that's driven by joystick data.

prilpi 03-17-2016 12:01 AM

Hi Jeff,

I tried to set this up directly through the code, start with the script.
I Then swap out the lines for key events with joystick events in the UpdateView function.
still, no response from controller
(probably as you said, the oculus linked to viewpoint and view linked to navigation node..)
Again, when disable the oculus code the controller works.

I also tried to config them thru the vizconnect,
but i couldn't parent the controller since its not shown in the root map (?)
(i set oculus DK2 as tracker and display and the xbox controller as input)

I understand that i can either write the code for the devices directly in vizard or config them in vizconnect and import to vizard..

I will dive deeper into vizconnect but at this moment i only need some basic features (oculus and controller) for testing architectural walk thrus
(the wireless controller is just for easier walking instead of mouse / keypad )

Regarding this, what do you think is better (code scripting or vizconnect) ?

I would really appreciate it if you can provide me with the full vizard code for the oculus plus xbox controller since i cant solve that viewlink / navigation node issue..:confused:


Jeff 03-17-2016 05:38 AM

1 Attachment(s)
It will be easier to use vizconnect for the setup. You can also use the same vizconnect file with the demo launcher and any of your own Vizard applications. Attached is a file you can try out. First run the vizconnect file directly. You'll need to go to the transports tab and press the mapping button to choose which xbox signals drive the transport. There's a height offset added to the DK2 tracker. Remove this offset if you're using position tracking. Once the config file works on it's own you can import it into other scripts.

prilpi 03-20-2016 10:00 PM

Hi Jeff,

VUALA !!:D It works!!!

Thanks a lot for the help
It keeps me improving every day...

I used the vizconnect file you sent me for the "piazza" and also copy it to the "maze" - both works great.
I didn't need to set the xbox controller mapping for the transport since it was already set (by default? or set by you before ?)

I tried to copy that same vizconnect config and use it with the "pit" but again
there is still a conflict and i cant get it to work (?)

I think its cuz "faller" linked to head_tracker / main view:

# Create tracked faller and link to main view
faller = PitTrackedFaller(head_tracker),viz.MainView)

and vizcam assigned "head_tracker" to keyboard/mouse navigator :

# Simulate head tracker using keyboard/mouse navigator
head_tracker = vizcam.addWalkNavigate()

When i disable the code above and import vizconnect -
oculus + controller works fine but..
No falling when i shift the floor..:confused:

I really hope you can guide me thru that "pit" faller issue..
(its not a must for me but that is a great way convincing people with VR..)

Next, ill try to run some tests with imported sketchup scenes (oculus + controller) and to get knowing my way with the inspector..

Thanks again for the great help !
I look forward to your response


Jeff 03-20-2016 10:46 PM

The demo launcher includes a version of the pit demo that works with vizconnect. Copy your vizconnect config file into the same folder as the launcher and then you'll have the option to select that config at run time. See the demo launcher tech tip for instructions on installing/running the launcher. It's not necessary to follow the 'configuring hardware' section since you already have a vizconnect file.

prilpi 03-23-2016 02:48 PM

Hi Jeff,

I run the demo launcher and downloaded the demo scenes.
Then i copied vizconnect config file into the same folder as the launcher

It all worked great until suddenly for some reason (?) when i'm looking around or moving around with the controller, the image in the oculus turns "jumpy" !!!

It just appeared from no where... i didn't change anything in the vizconnect config..
by the way, image on the PC screen is smooth
and the "maze" scene runs smooth.
any other scene with or without vizconnect turns "jumpy" in the Oculus..

what am i missing here ???

Jeff 03-23-2016 06:59 PM

What are the system specs?

prilpi 03-23-2016 10:02 PM

I'm running it on a new powerful machine matching high demands of VR uses:

OS - Win 8.1 pro 64
CPU - i7 6700 3.4
RAM - 16 GB
GPU - NVIDIA Geforce GTX 970 12 Mb

VIZARD 5.3 64
Oculus - SDK
controls - Wireless keyboard + wifi XBOX con'

Jeff 03-23-2016 11:02 PM

Is the framerate stable (press F4 with script running)? You could try updating the nvidia drivers or rolling back to a previous version if you already have the latest.

prilpi 03-23-2016 11:58 PM

opening any demo with demo launcher is "jumpy", frame rate stable at 74 - 75 fps
however, opening other file directly in Vizard (modern lobby demo) runs in extremely low frame rate (2 - 4 fps) !!!
ill check the nvidia driver and let you know if it changes

prilpi 03-27-2016 11:51 PM

Hi Jeff,
I updated the Nvidia driver to the latest.
It fixed the flickering problems in the Vizard Demos. :)

Moving on with this -
1. When opening the "modern apartment" demo:
eyes level is too high (and furniture looks little smaller as if the FOV in the oculus is not matching the real eyes FOV)
Is that a vizconnect config issue ?

2. When opening an skp model and walking inside:
looking in few directions looks good (stable at 75 fps)
while other directions are flickering (down to 34 fps)
(happens in the same places i look at - not randomly)
I deleted all furniture and high poly' objects so the total poly' count would be low but it still flickers..(?)

I will try it with some other skp models.
What might be the problem ?

Jeff 03-28-2016 02:30 AM

1. Are you using Oculus position tracking or just orientation? The vizconnect file I attached was configured with a height offset that assumes position tracking is not used. You can change the height offset in vizconnect. Press the offsets button for the oculus tracker and change the post trans y value.

2. Take a look at the optimization and performance pages in the Vizard help. The information there may help you determine what is causing the slow down if it's due to the models.

prilpi 03-28-2016 05:00 AM

Yes. I'm using oculus positional tracker.
I will try your suggestions.

All times are GMT -7. The time now is 08:56 PM.

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