![]() |
|
#1
|
|||
|
|||
Hi,
If you are only viewing each avatar one at a time, then you only need to add 3 avatars. When you are starting an avatar link the appropriate object to it. When you are done with the avatar unlink the object from it. |
#2
|
|||
|
|||
The only problem with that is that I would need more than 3 avatars to come out at once. The experimenter wants a continous flow of avatars. Would I be able to do this w/only an array of 3 avatars and the link and unlink?
|
#3
|
|||
|
|||
Hi,
You need to create at least the same number of avatars that you want to be visible at the same time. So if you only need 6 avatars to be visible at a time, then you need at least 6 avatars. |
#4
|
|||
|
|||
Thanks that helped a lot. I have the program functioning as I wanted it to. My next step is to "tag each avatar". When I call the avatars using:
Code:
#Create all the avatars and add them to the waiting list for x in range(0,3): if x == 0: male = viz.add(people[0]) male.scale(.1,.1,.1) link = viz.add(viz.GROUP) myphone = link.add(objects[0]) myphone.scale(.0005,.0005,.0005) male.linkbone(link,'skel_HandR') elif x == 1: male = viz.add(people[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') elif x ==2: male = viz.add(people[2]) 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.translate(3*x,-10,10) male.rotate(180) #Add the avatar to the waiting and lemming list waitlist.append(male) characters.append(male) Code:
def RestoreAvatar(): global keyindex if len(dead_list): print "avatar restored" avatar = waitlist.pop() #Ressurrect dead avatar avatar.visible(1) #Make it visible characters.append(avatar) #Add it to avatar list # walkAvatar(avatar) print 'avatar restored' def RemoveAvatar(avatar): avatar.visible(0) #Hide avatar #avatar._face_.visible(0) #Hide face avatar.speed(1) #Restore speed characters.remove(avatar) #Remove from list dead_list.append(avatar) #Add to dead list Code:
if info.intersected: autospawn = not autospawn print 'intersect point is',info.intersectPoint if info.object in waitlist: print "in waitlist" if info.object in dead_list: print "in dead_list" if info.object in characters: print "in characters" avatarsHit = avatarsHit + 1 viz.playsound('arrgh.wav') print 'Avatars hit: ', avatarsHit WaitThenFreeze = vizact.sequence( vizact.waittime(info.object.getduration(7)+.001), 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 |
#5
|
|||
|
|||
Hi,
I'm not sure exactly what you are asking here. You just need a way to identify each avatar when they get shot? Just add some tag to each avatar when you create/restore it. Code:
male.tag = 'avatar 1 with object 2' Code:
print info.object.tag,'got shot' |
#6
|
|||
|
|||
![]()
PERFECT! Thanks for the help. Can I do the same thing with the object they are holding? Since the object is a different array that's merely linked to this one, how do I identify the object in hand? Basically if it's a gun or a cell phone I just need to specify that it's "non-threatening". If it's a gun then i have to specify that it's "threatening".
Thanks again! |
#7
|
|||
|
|||
Hi,
In python, you can add as many attributes to an object as you wish. So to determine if an object is "threatening" simply give it an attribute which says so. Code:
donut = viz.add('donut.wrl') donut.isThreatening = False donut.isDelicious = True gun = viz.add('gun.wrl') gun.isThreatening = True gun.isDelicious = False |
![]() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|