View Single Post
  #1  
Old 03-21-2007, 03:59 AM
ghazanfar ghazanfar is offline
Member
 
Join Date: Mar 2007
Posts: 11
Problem with getting duration of walkto()

We are trying to let avatars walk to each other, after that face to each other and wave (say hello).

We have a problem with letting the avatars face to each other, because deciding which angle they have to rotate happens before the agents are done walking.

Does anyone know how to get the duration of walking to a certain point, so we can get the angle to rotate after the walking has finished? Or just letting the program wait until the walking has finished and the continue?

Our current code is the following:

if (ag1=='a1' and ag2=='a3'):
walk_over = male.walkto(meetingpoint[0]+1,meetingpoint[1],meetingpoint[2])
#This line calls that animation.
male.act(walk_over)

#THIS IS WHAT WE HAVE TRIED UNTIL NOW
#male_wave_duration = male.getduration(walk_over)
malepd=male.getduration(5) # THIS WORKS
print "malepd", malepd
#malewd2=male.getduration(walkto)
#print "malewd2", malewd2 # THIS RETURNS AN ERROR
malewd=male.getduration(male.walkto)
print "malewd", malewd # THIS RETURNS AN ERROR
#viz.starttimer(1,malewd )
#print "male_wave_duration", malewd
#wait until walk_over is ready

pos=male.get(viz.POSITION)
pos2=male1.get(viz.POSITION)
rotate_degrees = vizmat.AngleToPoint(pos[0],pos[2],pos2[0],pos2[2])
male.rotate(0,1,0,rotate_degrees)
male.act(5)
walk_over2 = male1.walkto(meetingpoint[0],meetingpoint[1],meetingpoint[2])
male1.act(walk_over2)
pos=male1.get(viz.POSITION)
pos2=male.get(viz.POSITION)
rotate_degrees = vizmat.AngleToPoint(pos[0],pos[2],pos2[0],pos2[2])
male1.rotate(0,1,0,rotate_degrees)
male1.act(5)
Reply With Quote