WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 12-11-2015, 07:04 AM
Seadna Seadna is offline
Member
 
Join Date: Nov 2015
Posts: 40
Question Turn using keyboard when using Oculus

Hi guys,

I cannot figure out how to get the viewpoint to turn using a key binding. I can obviously turn my head in the oculus rift, but this is not practical for the application. I need to be able to turn using a key on the keyboard (or controller). Is this possible? I'm using the sample Oculus code that came with Vizard.

Any help much appreciated,

Seadna.
Reply With Quote
  #2  
Old 12-11-2015, 08:51 AM
haohaoxuexi1 haohaoxuexi1 is offline
Member
 
Join Date: Sep 2015
Posts: 81
I think there is a demo using keyboard to control a BMW car, and that one should work
Reply With Quote
  #3  
Old 12-11-2015, 02:57 PM
mamort mamort is offline
Member
 
Join Date: Jun 2015
Posts: 18
have a look at "vizconnect" section in particular input, tracker and transport section. I think from memory you want to tie a keyboard input to the driving transport or maybe even pivot depends if you want to move around scene or just rotate.
Reply With Quote
  #4  
Old 01-11-2016, 04:19 AM
Seadna Seadna is offline
Member
 
Join Date: Nov 2015
Posts: 40
Could you provide an example code snippet of how this would be done? I'm new to python and currently learning it through using Vizard.
Reply With Quote
  #5  
Old 01-11-2016, 05:37 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Take a look at the 'Oculus Desktop Configuration' option in the vizconnect presets page. That adds a transport controlled by keyboard input signals.
Reply With Quote
  #6  
Old 01-11-2016, 07:22 AM
Seadna Seadna is offline
Member
 
Join Date: Nov 2015
Posts: 40
Great I think i have found what I need. Now i need to figure out how to fit it into what i have already coded.

Thank you Jeff.
Reply With Quote
  #7  
Old 01-11-2016, 08:15 AM
Seadna Seadna is offline
Member
 
Join Date: Nov 2015
Posts: 40
Question

OK I'm struggling with getting this into my code:

Code:
# Setup arrow key navigation
MOVE_SPEED = 2.0
def UpdateView():
                yaw,pitch,roll = viewLink.getEuler()
                m = viz.Matrix.euler(yaw,0,0)
                dm = viz.getFrameElapsed() * MOVE_SPEED
                if viz.key.isDown(KEYS['forward']):
                                m.preTrans([0,0,dm])
                if viz.key.isDown(KEYS['back']):
                                m.preTrans([0,0,-dm])
                if viz.key.isDown(KEYS['left']):
                                m.preTrans([-dm,0,0])
                if viz.key.isDown(KEYS['right']):
                                m.preTrans([dm,0,0])
                if viz.key.isDown(KEYS['up']):
                                m.preTrans([0,dm,0])
                if viz.key.isDown(KEYS['down']):
                                m.preTrans([0,-dm,0])
                if viz.key.isDown(KEYS['lt']):
                                m.turnLeft                           
                if viz.key.isDown(KEYS['rt']):
                                m.turnRight                            
                navigationNode.setPosition(m.getPosition(), viz.REL_PARENT)

vizact.ontimer(0,UpdateView)
You can see the lines I have put in with m.turnLeft and m.turnRight. These do not work like in the vizconnect example. I'm sure i need to add much more code or replace what I have here but there is so much in there that i dont know what to do with it.

I tried putting in m.preEuler(0,dm,0) and adding navigationMode.setEuler(m.getEuler(), viz.REL_PARENT) but that causes the view to rapidly spin constantly.
Reply With Quote
  #8  
Old 01-12-2016, 01:48 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Is there a reason you're trying to do this in your own script rather than use vizconnect?
Reply With Quote
  #9  
Old 01-12-2016, 04:04 AM
Seadna Seadna is offline
Member
 
Join Date: Nov 2015
Posts: 40
I hadn't used visconnect until you mentioned it here and I already have a lot of script put together. I'm not sure how to integrate my script with the mass of script that visconnect created or how to take the script I need from visconnect to integrate with my own.

Its seems like it should be much easier than this but then I'm quite new to this so i don't really know. I have learned everything so far from looking at the demos and samples and the help file that came with Vizard, but i can't find out how to do this.

Any help would be much appreciated!
Reply With Quote
  #10  
Old 01-12-2016, 10:54 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Take a look at the vizconnect tutorials. These will explain how to use the vizconnect config file in your own script.
Reply With Quote
Reply

Tags
controls, oculus, rotate, turning, view


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
Multiple post-process effects with oculus rift lklab Vizard 2 03-13-2015 01:48 PM
Oculus runtime disrupts clustering to mirror DK2 display performlabrit Vizard 1 01-23-2015 07:00 AM
Problem with navigation trough DK2 Oculus vantsal Vizard 2 12-11-2014 03:18 AM
Oculus DK1 and DK2 in Vizard 5 Jeff Vizard 3 10-02-2014 11:00 AM
oculus rift and inertia cube interaction problems apboone Vizard 4 03-13-2014 10:45 AM


All times are GMT -7. The time now is 01:16 PM.


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