WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 09-15-2008, 04:02 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
you could create a callback function that is called every time a timer expires. Within that function you could get the position of your cars and calculate the distance between them. If they are to close you could speed up the one in front and slow down the one behind.

Code:
import vizmat

#start a timer that will call onTimer() every 2 seconds
viz.starttimer(0,2,viz.FOREVER)

def onTimer(num):
	

	car1_Pos = car1.getPosition()
	car2_Pos = car2.getPosition()
	distance = vizmat.Distance(car1_Pos, car2_Pos)
	
	if distance is too close:
	
		#increase speed of path of car1
		#decrease speed of path of car2
		
		
		
viz.callback(viz.TIMER_EVENT,onTimer)

is that helpful?
Reply With Quote
 


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
Real Time Audio Data lomendil Vizard 2 06-02-2008 08:18 PM
Can I get real time Intersense tracking data from another computer on the network? GoldenSun Vizard 4 04-30-2008 07:42 PM
timer question Elittdogg Vizard 5 10-10-2007 02:49 PM
Animation Path djdesmangles Vizard 2 06-11-2007 03:37 PM
Animation Path djdesmangles Vizard 0 06-06-2007 11:03 AM


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


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