View Single Post
  #2  
Old 02-08-2011, 09:34 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You can set up parent/child relationships between vizshape objects:
Code:
import viz
import vizact
import vizshape

viz.go()

viz.move(0,0,-10)

cube1 = vizshape.addCube()
cube2 = vizshape.addCube()

cube2.parent(cube1)
cube2.setPosition([0,2,0])

spinForever = vizact.spin(0,1,0, 90, viz.FOREVER)
cube1.addAction(spinForever)
You could also make all your vizshape objects children of a group node and move the group node around:
Code:
import viz
import vizact
import vizshape

viz.go()

group = viz.addGroup()
group.setPosition([0,1.5,10])

positions = [[0,0,1],[0,0,-1],[-1,0,0],[1,0,0]]

for position in positions:
	cube = vizshape.addCube(size=0.5)
	cube.parent(group)
	cube.setPosition(position)

spinForever = vizact.spin(0,1,0, 90, viz.FOREVER)
group.addAction(spinForever)
Reply With Quote