#1
|
|||
|
|||
Wand triggers event
Hi,
We're trying to implement an event triggered by wand key press, that changes a texture of an object that the wand points to. It doesn't work for now. Here's the code: Code:
import viz import vizfx import vizconnect import vizact viz.antialias = 4 # Lines beginning with the '#' symbol will be treated as comments viz.fullscreen = 1 viz.clearcolor = (0.5, 0.5, 0.5 ) #viz.go() if __name__ == "__main__": vizconnect.go('./vizconnect_config.py') viz.MainView.getHeadLight().disable() else: vizconnect.go('./multiscript_vizconnect_config.py') #Add wand ppt=viz.add('ppt.dle') wand = ppt.addWand(1) #Add a sky with an environment map env = viz.add(viz.ENVIRONMENT_MAP, 'sky.jpg') dome = viz.add('skydome.dlc') dome.texture(env) showroom=viz.add('Showroom1.osgb') #showroom.setPosition(3,-6,3) for window in viz.getWindowList(): window.getView().getHeadLight().disable() video=viz.addVideo('Visvid_ver_2.mp4') video.play() video.loop() texture1=viz.addTexture('VisualisationPic.png') videowall=showroom.getChild('projection.002') videowall.texture(video) from tools import highlighter tool=highlighter.Highlighter() tool.setItems([videowall]) viz.link(wand,tool) #def onTrigger(): # print 'Trigger pressed' # updateHighlighter(tool) def updateHighlighter(tool): #state = viz.mouse.getState() tool.highlight() vizact.onsensordown(wand, ppt.BUTTON_UP, updateHighlighter) tool.setUpdateFunction(updateHighlighter) def onHighlight(e): if e.new == videowall: print 'videowall is highlighted' if videowall.texture==video: 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) light=viz.addLight() light.position(0,2,0,1) light.spread(180) #light.disable() light.color(0.2,0.2,0.2) light.quadraticAttenuation(.04) light.intensity(100) pointlight=vizfx.addPointLight(color=viz.WHITE,pos=(5,0,5)) pointlight.intensity(.5) pointlight.quadraticAttenuation(.01) #pointlight.disable() Another issue is that a videotexture is not visible (just white background), only the sound of the video is heard. Why? |
#2
|
|||
|
|||
The code is run with ppt-tracking, Oculus DK2 and wand. The error message that the code produces is as follows: 'trying serial 3
Wand: input buffer not flushed (Make sure port name is valid and it has not been opened by another program)'. |
Tags |
event, not visible, point to, videotexture, wand |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Event handling | mshukun | Vizard | 2 | 04-01-2013 10:22 AM |
Mouse event: how to detect no mouse move event, how to set mouse position? | Zhi | Vizard | 3 | 04-11-2011 07:25 PM |
how to cancel event? | shahramy | Vizard | 1 | 12-20-2010 09:52 AM |
Distance or position based event? | vissimutah | Vizard | 1 | 08-25-2009 01:26 PM |
sending event markers to a monitoring computer | mikestatic | Vizard | 3 | 01-26-2006 10:23 AM |