WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-30-2006, 06:32 AM
pattie pattie is offline
Member
 
Join Date: Aug 2006
Posts: 32
Vizlink problem

Below is a sample piece of code (numbered lines for clarity) that I play around with in order to make sure I understand the linking process.
1: import viz
2: viz.go()
3: block = viz.add('box.wrl')
4: block.translate(0,1.8,3)
5: marker = viz.add('marker.wrl')
6: marker.scale(0.1,0.1,0.1)
7: marker.translate(0,1.8,0)
8: link = viz.link(marker,block)
9: print "marker pos is: ", marker.getPosition()
10: print "block pos is: ", block.getPosition()
11: marker.translate(0,11,24)
12: print "marker pos is, after translation: ", marker.getPosition()
13: print "block pos is, after translation: ", block.getPosition()
14: link.remove()
15: marker.translate(0,1.8,41)
16: print "marker pos is, after remove: ", marker.getPosition()
17: print "block pos is, after remove: ", block.getPosition()

If I run this program, I notice that the block position (line 13), (the node being linked to the marker on line 8) is is not updated after the marker is translated (line11). I do not understand why. Shouldn't the block position be applied the translation too?

Furthermore, If I understand correctly, the remove() function is like an unlink command. Is that correct?

Thanks for your reply
Patrick
Reply With Quote
  #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
  #3  
Old 10-05-2006, 04:52 PM
pattie pattie is offline
Member
 
Join Date: Aug 2006
Posts: 32
VizLink problem

Thanks, Paul

Maybe it should be added in the help file, unless I missed it there.

Thanks for the help anyways
Patrick
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 03:39 PM.


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