View Single Post
  #1  
Old 09-24-2014, 06:31 PM
Melody Melody is offline
Member
 
Join Date: Aug 2014
Posts: 26
How to get pre and current position of a moving object

I tried to get pre and current position of my haptic device with timer.
But I got the pre and current positions are exactly the same.
Could you please let me know how to solve this problem?

Below please see my coding. Thank you in advance.

def getposition():
global currpos
global currposy
global preposy
currpos=mark.getPosition(viz.ABS_GLOBAL)
prepos=currpos
currpos=mark.getPosition(viz.ABS_GLOBAL)

def maintimer():
vizact.ontimer(0,getposition)

viz.callback(viz.KEYDOWN_EVENT,maintimer)
Reply With Quote