WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-20-2004, 06:54 AM
eugcc eugcc is offline
Member
 
Join Date: Apr 2004
Location: United Kingdom
Posts: 9
for loop concatenation for 300 billboarding trees

Hi there,

I'm trying to run through a loop to billboard many trees in a landscape, instead of doing:

land = viz.add('landscape.WRL')

tree1 = land.getchild('tree1')
tree1.billboard(2)

tree2 = land.getchild('tree2')
tree1.billboard(2)

...

tree300 = land.getchild('tree300')
tree300.billboard(2)

Can I do a loop with something like this that will allow all the trees to be billboarded? But it wouldn't work:

for i in range(20):
tree = land.getchild("tree" + i)
tree.billboard(2)

I'm doing this because the billboarded trees in 3dsmax exported to vrml and into vizard wouldn't work.

Thanks in advance
eugcc
__________________
Eugene
United Kingdom
Reply With Quote
  #2  
Old 04-20-2004, 09:23 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi eugcc,

What you did should work, except for the getchild part. You can't add an integer to a string. You need to convert the integer to a string then add it to the other string. Example:
Code:
for i in range(20):
    tree = land.getchild("tree" + str(i))
    tree.billboard(2)
Our vrml loader should support billboarding. Would you mind posting the model or sending it directly to me at lashkari@worldviz.com
We are always looking to improve our vrml loader. Thanks!
Reply With Quote
  #3  
Old 04-21-2004, 12:52 AM
eugcc eugcc is offline
Member
 
Join Date: Apr 2004
Location: United Kingdom
Posts: 9
Billboarding Trees Coordinate

Thanks for the very prompt reply as always!

Its working now except that the coordinates of each individual tree seemed to be off, like the coordinates of the tree is changed to the world origin, or they simply disappear.

I'll send the file to your email soon.

Thanks!
Eugene
__________________
Eugene
United Kingdom
Reply With Quote
  #4  
Old 04-21-2004, 10:11 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi Eugene,

I tried your file and billboarding worked automatically. Which version of Vizard are you running? The latest version is 2.15b, you might want to upgrade if you have an older version. Our vrml loader doesn't support sound, but I will go ahead and try to include that. In the meantime you could use the following code to play 3d sounds in your world:
Code:
#Create an invisible object that will play the sound
obj = viz.add(viz.GROUP)

#Place the object where we want the sound to come from
obj.translate(5,0,7)

#Loop a sound eminating from the objects location
obj.playsound('sound.wav',viz.LOOP)
Also, use the following code to add fog to your world:
Code:
#Set the fog color to white
viz.fogcolor(1,1,1)

#This will create exponential fog
viz.fog(0.1)

#This will create linear fog
viz.fog(5,20)
Good luck!
Reply With Quote
  #5  
Old 04-22-2004, 12:46 AM
eugcc eugcc is offline
Member
 
Join Date: Apr 2004
Location: United Kingdom
Posts: 9
Wink Perfect!

Thanks, these are handy tips.

eugcc
__________________
Eugene
United Kingdom
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


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


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