#1
|
|||
|
|||
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. |
#2
|
|||
|
|||
I think there is a demo using keyboard to control a BMW car, and that one should work
|
#3
|
|||
|
|||
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.
|
#4
|
|||
|
|||
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.
|
#5
|
|||
|
|||
Take a look at the 'Oculus Desktop Configuration' option in the vizconnect presets page. That adds a transport controlled by keyboard input signals.
|
#6
|
|||
|
|||
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. |
#7
|
|||
|
|||
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) 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. |
#8
|
|||
|
|||
Is there a reason you're trying to do this in your own script rather than use vizconnect?
|
#9
|
|||
|
|||
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! |
#10
|
|||
|
|||
Take a look at the vizconnect tutorials. These will explain how to use the vizconnect config file in your own script.
|
Tags |
controls, oculus, rotate, turning, view |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
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 |