View Single Post
  #1  
Old 10-11-2010, 09:08 AM
just alex just alex is offline
Member
 
Join Date: Nov 2008
Posts: 18
animation pausing problem

Hi,
I've got a program where a bunch of avatars are supposed to be walking around a city doing mundane things (window shopping, talking with someone, etc.)
My problem is that the avatars that I have just walking around the city block pause any time they reach a checkpoint in their animation path and they go back to their default state for a moment until they start walking again. I've tried a few tricks to get them to smooth out, but I can't figure out how to get them to just walk around. Here's the relevant code
Code:
males = []
females = []
walking = []
whichturn = 0

#List the timers.
WALKING = 0
for i in range(2):
	male = viz.add('male.cfg')
	male.translate(i,0,0)
	male.visible(0,'male_head.cmx')
	male.face(maleheads[i])
	clothes = viz.add(maleclothes[i])
	for j in bodyparts:
		male.texture(clothes,j)
	males.append(male)
		
for i in range(2):
	female = viz.add('female.cfg')
	female.translate(i,0,0)
	females.append(female)
#Set up paramters for walking guy.
males[0].translate(0,0,-5)
males[0].rotate(0,1,0,-90)
males[0].whichturn = 0
males[0].set = [[1.5,0,-5],[1.5,0,15],[5,0,15],[-5,0,-5]]
males[0].end = 4
walking.append(males[0])

#Set up paramters for walking girl.
females[0].translate(1,0,-7)
females[0].rotate(0,1,0,-90)
females[0].whichturn = 0
females[0].set = [[1.5,0,0],[1,0,15],[2,0,15],[-5,0,-5]]
females[0].end = 3
walking.append(females[0])
def onkeydown(key):
	if key == '0':
		viz.starttimer(WALKING, .1, viz.PERPETUAL)
def ontimer(num):
	global gravity, timebomb
	
	if num == DRIVING:
		for agent in driving:
			path.play()
	if num == WALKING:
		for agent in walking:
			agentposition = agent.get(viz.POSITION)
			agentgap = vizmat.Distance(agentposition, agent.set[agent.whichturn])
			if agentgap < .1:
				agent.whichturn += 1
				if agent.whichturn == agent.end:
					agent.whichturn = 0
			
			walk = vizact.walkto(agent.set[agent.whichturn][0],agent.set[agent.whichturn][1],agent.set[agent.whichturn][2])
			agent.addAction(walk)
Reply With Quote