WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-02-2015, 02:29 AM
Samuli Samuli is offline
Member
 
Join Date: Aug 2015
Posts: 15
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()
I would appreciate if someone would know how to help with this issue.
Another issue is that a videotexture is not visible (just white background), only the sound of the video is heard. Why?
Reply With Quote
  #2  
Old 09-02-2015, 03:32 AM
Samuli Samuli is offline
Member
 
Join Date: Aug 2015
Posts: 15
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)'.
Reply With Quote
Reply

Tags
event, not visible, point to, videotexture, wand

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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
Event handling mshukun Vizard 2 04-01-2013 09:22 AM
Mouse event: how to detect no mouse move event, how to set mouse position? Zhi Vizard 3 04-11-2011 06:25 PM
how to cancel event? shahramy Vizard 1 12-20-2010 08:52 AM
Distance or position based event? vissimutah Vizard 1 08-25-2009 12:26 PM
sending event markers to a monitoring computer mikestatic Vizard 3 01-26-2006 09:23 AM


All times are GMT -7. The time now is 08:44 AM.


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