WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-22-2008, 12:25 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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
  #2  
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
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
retrieve Object names Geoffrey Vizard 11 12-11-2009 04:26 AM
Child Object Rotation paulgoldberg Vizard 5 09-05-2006 11:33 AM
when collision mode is on, can i "turn it off" for an individual object? Vdoug Vizard 1 09-22-2005 12:14 PM
rotate to object jargon Vizard 1 08-08-2005 12:20 PM
Moving view with object Xliben Vizard 2 07-25-2005 05:36 PM


All times are GMT -7. The time now is 01:20 PM.


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