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)