|
#1
|
|||
|
|||
add info on avatar
info = vizinfo.add( 'WELCOME.' )
info.translate( .98, .3 ) i think this is how to add info onto the screen but how can i add this kind of info on specific avatar? for example i have three avatar i want to add different info on each avatar when i flash the marker to the webcam. |
#2
|
|||
|
|||
You can create a separate info box for each avatar. When a marker is in view change the visibility of the info box:
Code:
info = vizinfo.add('avatar') info.visible(viz.OFF) def updateInfo(): if marker.getVisible(): info.visible(viz.ON) else: info.visible(viz.OFF) vizact.ontimer(0,updateInfo) |
#3
|
|||
|
|||
jeff,
how can i do multiple if statements for the three different avatar ? |
#4
|
|||
|
|||
You could have multiple if/else statements one after the other in the timer function.
Or you could keep your markers, models, info boxes in lists and place a loop in the timer function. For each iteration of the loop you can check the visibility of a marker and set the visibility of the related info box. The following example would do that for 3 matrix markers, ids 1,2,3: Code:
import viz import vizact import vizinfo viz.go() MARKER_IDS = [1,2,3] AVATAR_FILES = ['vcc_male.cfg','vcc_female.cfg','duck.cfg'] INFO_POSITIONS = [[0.2,0.8],[0.2,0.6],[0.2,0.4]] INFO_MESSAGES = ['male','female','duck'] marker_list = [] avatar_list = [] info_list = [] #Add ARToolkit extension ar = viz.add('artoolkit.dle') #Create camera using first available webcam camera = ar.addWebCamera() for i in range(len(MARKER_IDS)): marker = camera.addMatrixMarker(MARKER_IDS[i],width=1000) avatar = viz.addAvatar(AVATAR_FILES[i]) avatar.visible(viz.OFF) viz.link(marker,avatar) info = vizinfo.add(INFO_MESSAGES[i]) info.visible(viz.OFF) info.translate(INFO_POSITIONS[i]) marker_list.append(marker) avatar_list.append(avatar) info_list.append(info) def updateVisible(): for i in range(len(MARKER_IDS)): if marker_list[i].getVisible(): info_list[i].visible(viz.ON) avatar_list[i].visible(viz.ON) else: info_list[i].visible(viz.OFF) avatar_list[i].visible(viz.OFF) vizact.ontimer(0,updateVisible) |
#5
|
|||
|
|||
it works ! thank you so much jeff
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Collision of an avatar with a quad | Frank Verberne | Vizard | 8 | 06-04-2008 09:44 AM |
Looking through the eyes of an avatar | Frank Verberne | Vizard | 2 | 04-01-2008 05:52 AM |
How to make avatar's eyes to blink when speaking | michelcm3 | Vizard | 12 | 01-15-2008 08:48 AM |
Turning info boxes on and off | Karla | Vizard | 2 | 12-17-2007 03:13 PM |
looking for more info on avatar studio commands | rosanna | Vizard | 1 | 03-26-2004 09:44 AM |