View Single Post
Old 09-01-2021, 10:03 AM
rdkirkden rdkirkden is offline
Join Date: May 2017
Posts: 20
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:

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
Attached Thumbnails
Click image for larger version

Name:	vizconnect scene graph2.png
Views:	438
Size:	136.7 KB
ID:	993  
Reply With Quote