WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-15-2006, 10:49 AM
betancourtb82 betancourtb82 is offline
Member
 
Join Date: Jan 2006
Posts: 103
Avatar walk

I was wondering if you could help me with this problem. I think it's more of a mathematical problem but I think it applies to programming. I need for avatars to appear from all directions instead of just in front of the person participating in the experiment. I can't seem to figure out how to set up my x,y,z to have this occur. We want avatars to appear from all directions and have the user actually have to look around to see where they are coming from.

Here is what I have so far:

Code:
for i in range(NUM_AVATARS):
	newX = -math.cos(-2*i+15) * 2
	newZ = math.sin(45*i) * 10
	male = viz.add('male.cfg')
	male.translate(newX,-10,newZ)
	male.rotate(180,0,0)
	avatars.append(male) #Save avatar in list
The interval that they appear is set by a timer. Here is that portion of the code.

Code:
def mytimer(num):
	global avatars
	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)
		
	elif num == START_AVATAR:
		global nextAvatar
		#Get the next available avatar and start it
		avatar = avatars[nextAvatar]
		#favatar = favatars[nextAvatar]
		walkAvatar(avatar)
		#walkAvatar(favatar)
		nextAvatar = (nextAvatar + 1) % NUM_AVATARS
		viz.starttimer(START_AVATAR,TIME_BETWEEN_AVATARS)


#Restore next available avatar
vizact.onkeydown(' ',RestoreAvatar)

#Shoot a ball whenever left mousebutton is clicked
vizact.onmousedown(viz.MOUSEBUTTON_LEFT,shootBullet)

#Create callbacks for timer events
viz.callback(viz.TIMER_EVENT,mytimer)

Last edited by betancourtb82; 03-15-2006 at 11:06 AM.
Reply With Quote
 

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 05:15 PM.


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