WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1  
Old 12-15-2006, 09:08 AM
giancamati giancamati is offline
Member
 
Join Date: Jun 2006
Posts: 27
Cool importing a single WRL with many objects.

Hello everybody,

I have this problem: I have a single wrl scene with many objects. When I use viz.add(...) function I can visualize the scene correctly. Now, the problem is the Vizards see the entire scene as a unique object instead of a set of objects.
This could be a problem when I would grab a single object in the scene. How can I solve this problem? That is importing a complete scene in wrl file and grabbing each element of the scene as a single object.
For example I have a wrl scene with 300 elements. Should I write viz.add(...) for 300 times if I want to load all these object separately?

Thank you very much.

Giancarlo
Reply With Quote
  #2  
Old 12-15-2006, 09:20 AM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
OK. At some point before collidemesh is called the objects will have to be seperated from eachother and made children of viz.WORLD. When you call viz.add () models are automaticly children of viz.WORLD. If you want to add all of the models at once you will need to get each object by the name it is assgined in the modeling program with the <VizNode>.getChild() method. This would be easier if they were given a nice namming convention in the modeling program so you could do this in a loop instead of hundrds of lines of code.

You could also export each object from the modeling program, hopefuly with some nice namming convention, and call viz.add() 300 times.

Code:
for i in range(NUMBER_OF_OBJECTS):
	object = viz.add('object' + str(i) + '.wrl')
	object.collideMesh()
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
  #3  
Old 12-18-2006, 10:49 AM
giancamati giancamati is offline
Member
 
Join Date: Jun 2006
Posts: 27
Unhappy I tyred

Hello,

I tryed to use viz.get(viz.WORLD) to get the list but it returns a list with length 2.
Why?

Thank you.
Giancarlo Amati
Reply With Quote
  #4  
Old 12-18-2006, 01:13 PM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
I think I did no make myself clear.

For collideMesh() to work, the model must be a child of viz.WORLD. If you import all your objects in one file, the objects will be children of the larger model/file object. So you would have to break the objects out of the model and set their parents to viz.WORLD. Here is some code showing what I am talking about.

bigModel = viz.add('allmyobjects.wrl')
smallThing = bigModel.getChild('mySubObjectName')
smallThing.parent(viz.WORLD)
smallThing.collideMesh()

You would have to do this for each model you want to be grabable. Allternativly, you could use the code in my last message and have each object be a seperate file.
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
Reply


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 09:24 PM.


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