WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 01-08-2009, 11:00 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
this should update the speed in just the y direction every time the timer function is called

Code:
#add textbox and set position on screen
text_speed = viz.addTextbox(parent = viz.SCREEN)
text_speed.setPosition(.15, .9 ) 
text_speed.fontSize (30)

old_posY = 0
def showSpeed():
	
	global old_posY
	
	current_pos = viz.MainView.getPosition()
	current_posY = current_pos[1]
	distance = abs(current_posY - old_posY)
	
	#get speed in meters/sec
	speed = distance/viz.elapsed()
	#get speed in km/hour
	speed = speed/1000*3600
	
	old_posY = current_posY
	
	#enter speed in textbox rounded to 1 digit after decimal
	text_speed.message(str(round(speed,1)) + 'km/hour')
	
vizact.ontimer(.25, showSpeed)
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
output data to screen Saz Vizard 1 12-19-2008 05:59 PM
Flagging the Data Elittdogg Vizard 5 04-11-2008 12:40 PM
Data Files betancourtb82 Vizard 6 05-04-2006 03:43 PM
Obtaining Positional Data Plasma Vizard 40 04-04-2006 12:31 PM
tracking using quaternarion data jfreeman Vizard 2 06-01-2005 09:48 AM


All times are GMT -7. The time now is 09:05 PM.


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