WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-21-2011, 09:29 AM
xcuddlex xcuddlex is offline
Member
 
Join Date: Feb 2011
Posts: 11
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.
Reply With Quote
  #2  
Old 04-21-2011, 05:03 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,466
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)
Reply With Quote
  #3  
Old 04-21-2011, 11:33 PM
xcuddlex xcuddlex is offline
Member
 
Join Date: Feb 2011
Posts: 11
jeff,
how can i do multiple if statements for the three different avatar ?
Reply With Quote
  #4  
Old 04-22-2011, 01:05 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,466
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)
Reply With Quote
  #5  
Old 05-01-2011, 07:00 AM
xcuddlex xcuddlex is offline
Member
 
Join Date: Feb 2011
Posts: 11
it works ! thank you so much jeff
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
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


All times are GMT -7. The time now is 04:14 PM.


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