View Single Post
  #2  
Old 02-02-2009, 10:56 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You can link an empty group node to your original parent object and then set the group node to be the parent of your child object. Then when you change the visibility of the original parent it won't affect the child. Here's an example.

Code:
import viz
viz.go()

box = viz.add('box.wrl',pos=[0,0,5])

#add empty group node and link it to the box
group = viz.addGroup()
link = viz.link(box,group)

#add the ball with the group node as parent
ball = viz.add('ball.wrl',parent=group,pos=[0,1,0])

#toggle box visibility
vizact.onkeydown(' ',box.visible,viz.TOGGLE)

#move box back and forth
moveback = vizact.goto(0,0,10,3)
moveforward = vizact.goto(0,0,5,3)
move = vizact.sequence([moveback,moveforward],viz.FOREVER) 
box.addAction(move)
Reply With Quote