View Single Post
  #3  
Old 06-11-2013, 07:35 AM
CompSci CompSci is offline
Member
 
Join Date: Jun 2013
Posts: 28
Hello,

Can you please add the code that enables real-time editing to this message box??

Thanks


Quote:
Originally Posted by farshizzo View Post
You can use the vizinfo module to display an information box. You can use the viz.MainWindow.worldToScreen command to convert world coordinates to screen coordinates, in order to position the info box near the avatar. Here is some sample code that shows how to accomplish this:
Code:
import viz
viz.go()

#Create avatar
female = viz.add('vcc_female.cfg',euler=(180,0,0),pos=(0,0,6))

#Create info box that is aligned to lower left corner
import vizinfo
info = vizinfo.add('')
info.alignment(vizinfo.LOWER_LEFT)

#Setup timer to position info box near avatar head
def UpdateInfoPosition():
	m = female.getBone('Bip01 Head').getMatrix(viz.AVATAR_WORLD)
	m.preTrans(0,0.2,0)
	x,y,z = viz.MainWindow.worldToScreen(m.getPosition())
	info.translate(x+0.03,y+0.02)
	info.visible(z>0)
vizact.ontimer(0,UpdateInfoPosition)

#Use the following code to change the message of the box
info.message('hello')
Reply With Quote