View Single Post
  #6  
Old 06-02-2016, 11:37 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You could calculate the velocity from one frame to the next using the following:

Code:
lastPos = [0,0,0]
def calculateVelocity():
	global lastPos
	pos = device.getPosition()
	distance = vizmat.Distance(lastPos,pos)
	velocity = distance/viz.getFrameElapsed()
	lastPos = pos
	
vizact.onupdate(0,calculateVelocity)
Reply With Quote