WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-28-2018, 05:34 AM
performlabrit performlabrit is offline
Member
 
Join Date: Oct 2013
Posts: 77
Success with <node>.setReferenceFrame()

Thanks jeff! The following code worked...
HTML Code:
	import vizshape
	r = vizshape.addSphere(0.05, color = viz.RED)
	r.setReferenceFrame(viz.RF_VIEW)
	r.setPosition([0,0,1])
Reply With Quote
  #2  
Old 03-01-2018, 07:41 AM
performlabrit performlabrit is offline
Member
 
Join Date: Oct 2013
Posts: 77
Problems continue. What's going on?

Sadly, my attempts to place a sphere along the gaze vector are still not behaving as expected. None of the parenting functions work, and viz.setRefrenceFrame is producing unpredictable results.

Here are two new attempts dropped into my vizconfig main function that uses the standard VIVE template. Neither work. Any advice from the peanut gallery?
HTML Code:
############# Attempt 1, what I thought would work...

	import vizshape
	
	IPD = viz.MainWindow.getIPD()

# It does seem that the right eye base is in the correct position and updates with head position
	rightEyeBase = vizshape.addSphere(0.05, color = viz.BLUE)
	rightEyeBase.setReferenceFrame(viz.RF_VIEW)
	rightEyeBase.setPosition([IPD/2,0,0])
	rightEyeBase.alpha(0.00)

link = viz.link(viz.MainView,rightEyeBase,viz.PRIORITY_SCENEGRAPH) # I tried with and without the link here
	link.setMask(viz.LINK_ORI)

	rightGazePoint = vizshape.addSphere(0.05, color = viz.YELLOW)
rightGazePoint.setReferenceFrame(rightEyeBase)
	
	smi = viz.add('smi_vive.dle')
	eyeTracker = smi.addEyeTracker()

	def updateGazeNode(vecLength = 3.0):
		
rDir = eyeTracker.getRightGazeDirection() 
rightGazePoint.setPosition(rDir[0]*vecLength,rDir[1]*vecLength,rDir[2]*vecLength)   
		
	vizact.onupdate(viz.PRIORITY_LAST_UPDATE,updateGazeNode)

###########



############# Attempt 2, based on the example provided by Worldviz (smiViveExample.py)
## Note that this doesn't accoutn for the right eye offset.

	import vizshape
	
	IPD = viz.MainWindow.getIPD()
	rightEyeBase = vizshape.addSphere(0.05, color = viz.BLUE)
	rightEyeBase.setReferenceFrame(viz.RF_VIEW)
	rightEyeBase.setPosition([IPD/2,0,0])
	rightEyeBase.alpha(0.00)

	rightGazePoint = vizshape.addSphere(0.05, color = viz.YELLOW)
	#rightGazePoint.setReferenceFrame(rightEyeBase)
	
	
	smi = viz.add('smi_vive.dle')
	eyeTracker = smi.addEyeTracker()

	def updateGazeNode(vecLength = 3.0):
		
		gazeMat = eyeTracker.getMatrix()
		gazeMat.postMult(viz.MainView.getMatrix())
		rightGazePoint.setMatrix(gazeMat)
		
	vizact.onupdate(viz.PRIORITY_LAST_UPDATE,updateGazeNode)
###########
Reply With Quote
Reply


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
Child node coordinates fabioped Vizard 1 10-09-2013 02:40 PM
Problems with using WIRKS without the Kinect in a mirror setting Jennifer Vizard 0 06-03-2013 03:17 PM
Setting up render node for shadowing whaleeee Vizard 2 05-06-2013 10:20 AM
trouble changing subnode (child node) color, alpha, etc. michaelrepucci Vizard 7 01-14-2009 08:38 PM
Pivot points for child objects in Vizard with 3ds Max Gladsomebeast Vizard 0 09-19-2006 11:21 AM


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


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