|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
One way to do this is to first create a group tracker in vizconnect that will contain the modified tracking data without roll. Next, in the avatar animator set the avatar head to move with this group tracker. Then in a callback function, which could be in the postInit or the application script, set the group tracker's position,yaw, and pitch using data coming from the Oculus tracker. Here's an example function:
def postInit(): """Add any code here which should be called after all of the initialization of this configuration is complete. Returned values can be obtained by calling getPostInitResult for this file's vizconnect.Configuration instance.""" Group tracker need to be added to vizconnect and used in animator groupTracker = vizconnect.getRawTracker('headTrackerGroup') steamHeadTracker = vizconnect.getRawTracker('head_tracker') def onUpdate(): pos = oculusHeadTracker.getPosition(viz.ABS_GLOBAL) ori = oculusHeadTracker.getEuler(viz.ABS_GLOBAL) Set roll to 0 ori = [ori[0], ori[1], 0] groupTracker.setPosition(pos, viz.ABS_GLOBAL) groupTracker.setEuler(ori, viz.ABS_GLOBAL) vizact.onupdate(vizconnect.PRIORITY_ANIMATOR+1, onUpdate) return None |
#2
|
|||
|
|||
Hi Sado,
Thanks for getting back to me with such detailed advice! I’ve got it working now. I did one thing differently by mistake, but then left it as it was because I think it suits the design of my program. I’ll outline what I did, in case this is useful for anybody else. I admit that the things I did that deviated from your advice were pretty haphazard, but it worked in the end. The main thing I did differently was that I used the group tracker to prevent roll on the mouse controls instead of on the Oculus HMD. I realise this makes no sense, given that my objective was to prevent rolling when the HMD turned from side to side – as I said, it was a mistake! But in my program I want to restrict the mouse controls to yaw only, and when I used the group tracker to prevent both roll and pitch movements on the mouse, this somehow stopped the HMD from producing the unwanted roll when turning from side to side. I should add that I had no choice but to prevent pitch movements on the mouse, because they were being accompanied by an unpleasant lurching forward/rolling behaviour. I intend to keep the transport for linear movements, i.e. backwards, forwards, left and right. I’m going to upgrade from the DK2 to a Rift S and when I do I hope to replace my gamepad controller with a touch controller, so that the player can have the touch controller in one hand and the mouse in the other. Hopefully it is possible to use just one touch controller – I haven’t tried this yet. The keyboard would be an alternative if I used the Mouse and Keyboard Walking tracker instead of the Mouse Orientation tracker, but I think a touch controller thumbstick would be easier to use while wearing an HMD. Also, I want to use one of the keys on the controller. I set up the vizconnect scene graph as shown in the image. I set up the vizconnect avatar animator with the head tracker, as setting it up with the mouse orientation group tracker caused some unpleasant effects. The head tracker was specified in the transport settings. Then I added the following code to the postInit() function of the vizconnect file: Code:
def postInit(): """Add any code here which should be called after all of the initialization of this configuration is complete. Returned values can be obtained by calling getPostInitResult for this file's vizconnect.Configuration instance.""" import vizact groupTracker = vizconnect.getRawTracker('mouse_orientation_group') mouseOrientationTracker = vizconnect.getRawTracker('mouse_orientation') def onUpdate(): pos = mouseOrientationTracker.getPosition(viz.ABS_GLOBAL) ori = mouseOrientationTracker.getEuler(viz.ABS_GLOBAL) #Set pitch and roll to 0 ori = [ori[0], 0, 0] groupTracker.setPosition(pos, viz.ABS_GLOBAL) groupTracker.setEuler(ori, viz.ABS_GLOBAL) return None vizact.onupdate(vizconnect.PRIORITY_ANIMATOR+1, onUpdate) return None |
#3
|
|||
|
|||
Having revisited my program after a long delay, I’ve realised there is one problem with how it behaves. As long as the avatar remains in the starting position, rotation with the mouse works fine. But if the player uses the game controller to move the avatar backwards/forwards/sideways and then uses the mouse to rotate, instead of rotating on the spot, the avatar turns in a circle whose centre is the starting position. It is as if the mouse orientation tracker does not know that the avatar’s position has changed. I have tried setting the group tracker’s position equal to the head tracker’s position, instead of the mouse orientation tracker’s position, but this made no difference. It also occurred to me that I might need to get the position of the wrapped head tracker, as opposed to the raw head tracker, since position changes don’t always affect a raw tracker’s position values, but this did not help either. I attach my Vizconnect file in .txt format. Please can anybody give me advice?
|
Tags |
combining trackers, motion sickness, mouse & keyboard walking, oculus dk2 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Walking is reversed in X and Z axes with motion capture. | amir | Vizard | 2 | 07-31-2018 07:18 PM |
motion tracker changes Vizard timing | jelly | Vizard | 4 | 06-13-2016 11:34 AM |
how to reduce motion sickness with Oculus rift+logitech driving force | hzhao | Vizard | 2 | 09-23-2015 06:34 AM |
Oculus runtime disrupts clustering to mirror DK2 display | performlabrit | Vizard | 1 | 01-23-2015 07:00 AM |
Intermittent orthographic stereo projection problems | AySz88 | Vizard | 10 | 02-17-2012 12:50 PM |