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)
|