View Single Post
  #1  
Old 04-11-2011, 06:59 AM
xcuddlex xcuddlex is offline
Member
 
Join Date: Feb 2011
Posts: 11
vizard marker visible

i know this code is to display avatar only when the marker is shown
import viz
viz.go()

#Add ARToolkit extension
ar = viz.add('artoolkit.dle')

#Create camera using first available webcam
camera = ar.addWebCamera()

#Create matrix marker
marker = camera.addMatrixMarker(0,width=1000)

#Add avatar model and set state 1
avatar = viz.add('vcc_male.cfg')
avatar.state(1)

#Link avatar model to marker sensor
viz.link(marker,avatar)

#Method that update if the marker is visible
def updateVisible():
if marker.getVisible():
avatar.visible(viz.ON)
else:
avatar.visible(viz.OFF)

vizact.ontimer(0,updateVisible)


but what if i have multiple avatar? i want to display avatar1 only when marker1 is shown to the camera? and avatar2 only when marker2 is shown and so on. python does not have switch statement right? please help !
Reply With Quote