WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-20-2006, 12:50 PM
betancourtb82 betancourtb82 is offline
Member
 
Join Date: Jan 2006
Posts: 103
Question More Animations

I am still relatively new to Vizard and had a question on arrays. I have created (with some help from farshizzo) an array that holds 5 avatars.

Code:
#Create six avatars
for i in range(NUM_AVATARS):
	
	newX = -math.cos(-2*i+15) * 2
	newZ = math.sin(i^2+1) * 2	
	male = viz.add('male.cfg')
	male.translate(newX,0,newZ)
	male.rotate(180,0,0)
	avatars.append(male) #Save avatar in list
#	walkAvatar(_avatars)
walk = male.walkto(0,0,-10.5,1,0,2)
I was able to make each of these avatars walk in a separate way, but now I want to make them "die" once I click on them. I have a shoot bullet animation so it looks like they are getting shot, but in actuality they are just being clicked on. The suggestion made by Farshizzo on the avatar animations thread worked for a stationary avatar but once they start moving using the following code, they get up even after I "shoot" them. Any suggestions?:
Code:
def mytimer(num):
	
	if num == ANIMATION:
		
		#Calculate elapsed time since last update
		elapsed = viz.elapsed()
		
		#Update each active ball
		for bullet in bullets:
			if bullet.active:
				#Move the ball and check if it has collided with any objects
				MoveBullet(bullet,elapsed)
		
		#Update the crosshair position
		crosshair.translate(viz.mousepos()+[0])
		
	elif num == START_AVATAR:
		global nextAvatar
		#Get the next available duck and start it
		avatar = avatars[nextAvatar]
		walkAvatar(avatar)
		nextAvatar = (nextAvatar + 1) % NUM_AVATARS
		viz.starttimer(START_AVATAR,TIME_BETWEEN_AVATARS)

##Start a timer which starts the next available avatar
viz.starttimer(START_AVATAR,0.01)
Thanks

Last edited by betancourtb82; 02-21-2006 at 10:48 AM.
Reply With Quote
  #2  
Old 02-21-2006, 10:40 AM
betancourtb82 betancourtb82 is offline
Member
 
Join Date: Jan 2006
Posts: 103
Question Problem Solved, on to the next one

Ok, I solve the problem I was having yesterday by adding a
Code:
clear(viz.ALL)
clear(viz.CURRENT_ACTION)
Now my next question would be, how can I take the fallen avatar out of the scene and reset him/her to a new avatar, i.e. how can I remove him from the array and place another one in the array.

Thanks
Reply With Quote
  #3  
Old 02-21-2006, 11:30 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

The following will remove an avatar from the array:
Code:
avatars.remove(male)
Then you would use the append command to add a new avatar:
Code:
avatars.append(male)
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:08 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC