I'm having a problem using faces on my avatars. I define my avatars using the following code:
Code:
#Avatars
for x in range(0,3):
if x == 0:
male = viz.add(people[0])
male.face(faces[0])
male.scale(.1,.1,.1)
link = viz.add(viz.GROUP)
myphone = link.add(objects[0])
myphone.scale(.001,.001,.001)
male.linkbone(link,'skel_HandR')
male.tag = 0
male.threatening = TRUE
elif x == 1:
male = viz.add(people[1])
male.face(faces[1])
# link = viz.add(viz.GROUP)
# myphone = link.add(objects[1])
# myphone.scale(.0005,.0005,.0005)
# myphone.translate(0,-.25,.17)
# myphone.rotate(180)
# male.linkbone(link,'skel_Neck')
link = viz.add(viz.GROUP)
myphone = link.add(objects[0])
myphone.scale(.001,.001,.001)
male.linkbone(link,'skel_HandR')
male.tag = 1
male.threatening = FALSE
elif x ==2:
male = viz.add(people[2])
male.face(faces[2])
link = viz.add(viz.GROUP)
myphone = link.add(objects[0])
myphone.scale(.001,.001,.001)
male.linkbone(link,'skel_HandR')
# link = viz.add(viz.GROUP)
# myphone = link.add(objects[2])
# myphone.scale(.0008,.0008,.0008)
# myphone.rotate(66.51,151.49,86.01)
# myphone.translate(-0.02,0.04,0.02)
# male.linkbone(link,'skel_HandRF')
male.tag = 2
male.threatening = FALSE
male.translate(3*x,-10,10)
male.rotate(180)
#Add the avatar to the waiting and lemming list
waitlist.append(male)
characters.append(male)
When they get hit, they perform a falling action with the following code:
Code:
if info.intersected:
if info.object in faces:
print 'Face hit'
if info.object in characters:
#print "in characters"
if info.object.tag == 0:
soldierCount += 1
if info.object.threatening == TRUE:
threatCount += 1
elif info.threatening == FALSE:
nonthreatCount += 1
elif info.object.tag == 1:
maleCount += 1
if info.object.threatening == TRUE:
threatCount += 1
elif info.object.threatening == FALSE:
nonthreatCount += 1
elif info.object.tag == 2:
femaleCount += 1
if info.object.threatening == TRUE:
threatCount += 1
elif info.object.threatening == FALSE:
nonthreatCount += 1
avatarsHit = avatarsHit + 1
viz.playsound('arrgh.wav')
WaitThenFreeze = vizact.sequence( vizact.waittime(info.object.getduration(7)-.85), vizact.speed_node(0) )
info.object.execute(7)
info.object.clear(viz.ALL)
info.object.clear(viz.CURRENT_ACTION)
info.object.add(WaitThenFreeze) #Add the action to the avatar
RemoveAvatarAction = vizact.call(RemoveAvatar,info.object)
info.object.add(RemoveAvatarAction) #Add action to remove avatar
The problem I'm having is when I shoot them in the face (yes, i know it's a bit violent
), they don't respond. Is there anyway to correct this? I want them to perform the same action as when they are shot in the body and also be able to keep track of how many face hits there are.