WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-24-2015, 01:08 AM
Samuli Samuli is offline
Member
 
Join Date: Aug 2015
Posts: 15
Using highlighter tool with wand

Hi,
I'm trying to convert WorldViz Highlighter tool example code (http://docs.worldviz.com/vizard/Tools_Highlighter.htm) into a script that uses wand as input (rather than mouse scrollwheel) and changes texture of an object. Here's the code:
Code:
import viz
import vizfx
import vizconnect
import vizact
import vizshape

viz.antialias = 4

viz.fullscreen = 1
viz.clearcolor = (0.5, 0.5, 0.5 )

if __name__ == "__main__":
	vizconnect.go('./vizconnect_config.py')
	viz.MainView.getHeadLight().disable()
else:
	vizconnect.go('./multiscript_vizconnect_config.py')

#Add wand
wand= vizconnect.getTracker('r_hand_tracker').getNode3d()
wandInput=vizconnect.getInput('r_hand_tracker')
#Add a sky with an environment map
env = viz.add(viz.ENVIRONMENT_MAP, 'sky.jpg')
dome = viz.add('skydome.dlc')
dome.texture(env)

#Add showroom osgb file
showroom=viz.add('Showroom1.osgb')


for window in viz.getWindowList():
		window.getView().getHeadLight().disable()

#Add video texture
video=viz.addVideo('VisualisationDemoVideo_v2.mov')
video.play()
video.loop()
videowall=showroom.getChild('projection.002')
videowall.texture(video)

#Get a handle to a texture
texture1=viz.addTexture('VisualisationPic.png')

#Get and set highlighter tool
from tools import highlighter
tool=highlighter.Highlighter(highlightOnCollision=False,highlightMode=highlighter.MODE_OUTLINE)
tool.setItems([videowall])

viewGroup=viz.addGroup()
viewGroupLink=viz.link(viz.MainView,viewGroup)
viewGroupLink.preTrans([0, 0, 1])
arrow = vizshape.addArrow(length=0.2, color = viz.ORANGE,parent=viewGroup)
arrowLink = viz.link(wand,arrow,mask=viz.LINK_ORI)
arrowLink.postMultLinkable(viz.MainView)
viz.link(arrowLink,tool)
  
def updateHighlighter(tool):
   
    tool.highlight()

tool.setUpdateFunction(updateHighlighter)

def onHighlight(e):

    if e.new == videowall:
        print 'videowall is highlighted'
        tex1=videowall.getTexture()
        if tex1==video:
            print 'change'
            videowall.texture(texture1)
        else:
            videowall.texture(video)
    
viz.callback(highlighter.HIGHLIGHT_EVENT,onHighlight)

showroom.disable(viz.LIGHTING)

headlight=viz.MainView.getHeadLight()
headlight.disable()

viz.MainView.setPosition(-5,2,-5)
We use wand 2014 local with PPT tracking.
The above mentioned code works, but not the way I want it to work. The beam of the highlighter tool starts from a fixed point and it doesn't follow the main view. How could the beam start point be main view and how would the target follow the wand?
Reply With Quote
  #2  
Old 09-24-2015, 12:38 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Quote:
How could the beam start point be main view and how would the target follow the wand?
Are you saying you want the line to start at the viewpoint location and finish at the location the wand is pointing to? If so, this is not possible with the highlighter tool. The attachment point of the highlighter determines both it's direction and starting point.
Reply With Quote
  #3  
Old 09-24-2015, 12:50 PM
Samuli Samuli is offline
Member
 
Join Date: Aug 2015
Posts: 15
Yes, that's exactly what I'm saying. Unity 3d has for example raycasting system from main camera point to a certain direction. That's easier to program with. Is there any other class/function in Vizard to use in this case instead of highlighter tool? How does the attachment point determine technically the direction and starting point?
Reply With Quote
Reply

Tags
highlighter, tool, wand


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
How to get wand tracker? Samuli Vizard 4 09-18-2015 12:09 PM
Wand triggers event Samuli Vizard 1 09-02-2015 03:32 AM
Intersense wand and Head tracker blessonisaac Vizard 0 01-10-2011 03:39 PM
question about IS-900 wand nitao Vizard 2 12-14-2009 10:54 AM
CAVE, navigation, tracked wand, coordinate systems JimC Vizard 6 10-09-2009 12:43 PM


All times are GMT -7. The time now is 12:18 AM.


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