WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-07-2010, 09:59 AM
Moh200jo Moh200jo is offline
Member
 
Join Date: Feb 2009
Posts: 99
Thanks for this, and it is understood
I tried to do the following but still incorrect
Code:
def onCollideBegin(e):
	if e.obj1 == box1 and  e.obj2== box2:
                      print e.obj1 , “    ,” , e.obj2
                      action=vizact.call( task1())
viz.callback(viz.COLLIDE_BEGIN_EVENT,onCollideBegin)
ball=0
def task1():
global ball
	while ball <4:
		yield viztask.waitEvent(action)
		ball +=1
		
		print 'Number of Balls is : ',ball
My problem I do not understand how can connect these functions
Any help?
Reply With Quote
  #2  
Old 01-08-2010, 04:34 AM
Moh200jo Moh200jo is offline
Member
 
Join Date: Feb 2009
Posts: 99
I have tried to use box1.collidingwith(box2) but this made the game meet the condition once I run the code

Code:
 ball=0
def task1():
global ball
	while ball <4:
		action=box1.collidingwith(box2)
		yield viztask.waitEvent(action)
		ball +=1
		
		print 'Number of Balls is : ',ball
Reply With Quote
  #3  
Old 01-08-2010, 08:48 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
There a few ways you could do this. You could use viztask's signal and wait functions and send a signal when the collision of those objects occurs within your onCollideBegin function. Then wait for that signal in your task function.

Or you could create a custom event that is generated when those two objects collide and wait for that event in your task function. The docs describe how to create a custom event.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tasks Moh200jo Vizard 1 02-23-2009 10:57 AM
Vizard Tip of the Month: Use Tasks to Simplify your Code Gladsomebeast Vizard 5 05-02-2008 04:30 PM


All times are GMT -7. The time now is 02:01 PM.


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