Thread: Vizlink problem
View Single Post
  #2  
Old 10-02-2006, 09:55 AM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
The link object only updates the position of the destination objects every update-cycle/frame so you have wait a frame before the block takes on a new position.

Code:
import viz
viz.go()
block = viz.add('box.wrl')
block.translate(0,1.8,3)
marker = viz.add('marker.wrl')
marker.scale(0.1,0.1,0.1)
marker.translate(0,1.8,0)
link = viz.link(marker,block)
print "marker pos is: ", marker.getPosition()
print "block pos is: ", block.getPosition()
marker.translate(0,11,24)

counter = 0
def onTimer(num):
	global counter
	if counter == 0:
		print "marker pos is, after translation: ", marker.getPosition()
		print "block pos is, after translation: ", block.getPosition()
		link.remove()
	if counter == 1:
		#marker.translate(0,1.8,41)
		print "marker pos is, after remove: ", marker.getPosition()
		print "block pos is, after remove: ", block.getPosition()
	counter += 1

viz.callback( viz.TIMER_EVENT, onTimer )
viz.starttimer( 0, .01667, viz.FOREVER )
__________________
Paul Elliott
WorldViz LLC
Reply With Quote