PDA

View Full Version : How to wirte words on a BillBoard?


znchb
10-25-2008, 08:35 PM
:confused:Hi, Is there any tutorial to show me how to wirte words on a BillBoard & the words can be changed.

such as, when we click the keyboard, it will be changed to some other words that we already prepared.

znchb
10-26-2008, 05:32 PM
I just know hot to attach a picture that contains words to a 'BillBoard' ,

Eg.
self.billboard2 = viz.add('c:\\VirtualWorlds\\table\\billboard.3DS')
self.slide = viz.add('c:\\VirtualWorlds\\table\\slide2.jpg')#.j pg contain words
self.billboard2.texture(self.slide)

but not show words on 'BillBoard' directly, Is there some one help me and give me an simple example for attaching words directly?
Thanks a lot.

Jeff
10-26-2008, 06:36 PM
You can make a text3d object a child of a texture quad. Here, the text object is slighly offset the quad in the z direction so it can be seen clearly.
Press the spacebar to change the message

import viz

viz.go()

# Create surface to wrap the texture on
quad = viz.addTexQuad()
quad.setPosition([0, 1.5, 3]) #put quad in view

# Wrap white texture on quad
quad.texture(viz.WHITE)

#create text object and make it a child of the texture quad
text = viz.addText( 'message', quad )
text.setScale(.1,.1,.1)
text.alignment(viz.TEXT_CENTER_CENTER)
text.color(viz.BLACK)
text.setPosition(0,0,-.01)

#press space bar to change message
vizact.onkeydown(' ', text.message, "new message")

znchb
10-26-2008, 09:13 PM
#some problems exist. if I use quad = viz.addTexQuad(), then I can not add #the 'billboard' to the scene. how to figure out this? Appreciate

import viz

viz.go()

####### Create surface to wrap the texture on
#quad = viz.addTexQuad()
#quad.setPosition([0, 1.5, 3]) #put quad in view
#quad.texture(viz.WHITE)
########create text object and make it a child of the texture quad
#text = viz.addText( 'message', quad )
#text.setScale(.1,.1,.1)
#text.alignment(viz.TEXT_CENTER_CENTER)
#text.color(viz.BLACK)
#text.setPosition(0,0,-.01)

#####press space bar to change message
#vizact.onkeydown(' ', text.message, "new message")

#####Whether we can do like this: ???
main = viz.add('c:\\VirtualWorlds\\table\\poolTableScene. 3DS') # the main scene
billboard = main.getChild('billboards') # object, named 'billboards', component of 'poolTableScene.3DS'

#quad = billboard.addTexQuad()

quad.setPosition([0, 1.5, 3])

quad.texture(viz.WHITE)

text = viz.addText('message', quad)
text.setScale(0.2,0.2,0.2)
text.alignment(viz.TEXT_CENTER_CENTER)
text.color(viz.BLACK)
text.setPosition(0,0,-.01)

vizact.onkeydown(' ', text.message, "new message")

znchb
10-26-2008, 09:27 PM
the scene file

Jeff
10-27-2008, 09:50 AM
You can make the text3d object a child of the billboard.

import viz

viz.go()

billboard = viz.add('billboard.3ds', pos = [0,0,5])

#create text object and make it a child of the billboard
text = viz.addText( 'message', billboard )
text.setScale(.1,.1,.1)
text.alignment(viz.TEXT_CENTER_CENTER)
text.color(viz.BLACK)
text.setPosition(0,1.7,-.05)

#press space bar to change message
vizact.onkeydown(' ', text.message, "new message")

Depending on what you want to do with this billboard it might be better to create textures with different text in them and swap the textures on the billboard

By the way, we recommend exporting 3ds models into Vizards native file format (.ive/.osg). It supports baked lighting and other advanced features.
You can download the exporter for Max from our downloads page.

znchb
10-30-2008, 12:26 AM
Oh, it works. Thanks

you are genious!

znchb
11-02-2008, 07:00 AM
# I want to show balls on the screen one by one, not all the balls appear immediately.
:confused:# could you please help me to use the time function to control it. Appreciate.

import viz
viz.go()

OriginalBall = viz.add('ball.wrl')

for x in [0, 0.2, 0.4, 0.6, 0.8]: ## nested loop
for y in [0, 0.3, 0.6, 0.9]:
ball = OriginalBall.copy() ##use the copy() to save cpu resource
ball.translate(2+x, 2+y, 2)
ball.setScale(0.02,0.02,0.02)

znchb
11-02-2008, 07:04 AM
sorry to make a mistake.
I suppose to post it as a new Question Topic.