WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #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
  #2  
Old 04-11-2011, 04:52 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You could use multiple if statements in the updateVisible function.
Reply With Quote
  #3  
Old 04-18-2011, 01:54 AM
xcuddlex xcuddlex is offline
Member
 
Join Date: Feb 2011
Posts: 11
def updateVisible():
if marker.getVisible():
marker1.visible(viz.ON)
elif
marker2.visible(viz.ON)
else:
avatar.visible(viz.OFF)

this doesnt work
i got an error and it wont run
is the syntax wrong ? i'm not familiar with python
Reply With Quote
Reply

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
Realistic Light and Shadows Using Vizard and 3DS Max jde Vizard 4 07-13-2012 10:58 AM
Vizard 4 Beta Testing farshizzo Announcements 0 02-01-2011 10:46 AM
Vizard 4 Beta Testing farshizzo Vizard 0 02-01-2011 10:46 AM
Vizard tech tip: Using the Python Imaging Library (PIL) Jeff Vizard 0 03-23-2009 11:13 AM
Vizard tech tip: Text to Speech Jeff Vizard 1 01-15-2009 09:39 PM


All times are GMT -7. The time now is 03:55 AM.


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