WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 12-22-2006, 10:27 AM
Jerry Jerry is offline
Member
 
Join Date: Jun 2004
Posts: 105
STOP_EVENT format

This code works in Viz2:

def FinishedMoving(object,type):
if type == viz.MOVE:
i = 1

viz.callback(viz.STOP_EVENT,FinishedMoving)

but Viz 3 gives this error:

TypeError: FinishedMoving() takes exactly 2 arguments (1 given)

What modification is required to make it work in Viz3?
Reply With Quote
  #2  
Old 12-22-2006, 10:47 AM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
Many of the events in have been changed to provide Data object as arguments which have various atributes about the event. To see what atributes an object in python has call

print dir(object)
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
  #3  
Old 12-22-2006, 10:50 AM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
The stop event has these attributes:
action
instance
object
pool

I think you want to compare the "action" atribute to vizact.VizMove. Try printing the varioius atributes to see what you should compair to.
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
  #4  
Old 12-22-2006, 11:39 AM
Jerry Jerry is offline
Member
 
Join Date: Jun 2004
Posts: 105
For others who might have this question, the Viz3 way to find out if
an object has stopped moving (goto or spinto) is:

Code:
import viz

viz.go()

ground = viz.add('tut_ground.wrl')

ground.addAction(vizact.spinto(0,1,0,90,90))

def FinishedMoving(e):	

	if e.object == ground:
		print 'done'

viz.callback(viz.ACTION_END_EVENT,FinishedMoving)
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 10:05 AM.


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