WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-16-2006, 01:33 PM
betancourtb82 betancourtb82 is offline
Member
 
Join Date: Jan 2006
Posts: 103
Holding Objects

I was wondering if anyone can help me out. I have an avatar array and I would like for each avatar to hold one weapon using the GetWeapon() function. I was wondering if it would be possible to, on a mouse click, have the avatars change their weapons (i.e. randomize which avatar is holding which weapon. I have included my code for the avatar array and the GetWeapon() function.
Code:
def GetWeapon(avatar,number):
 global link
 if number == 0:
  #weapons to use
  gunlink = viz.add(viz.GROUP) #for gun
  gun = gunlink.add('M16M203.WRL')
  avatar.gun = gun
  gun.scale(.0005,.0005,.0005)
  gunlink.link(hand)
 elif number == 1:
  phonelink = viz.add(viz.GROUP) #for phone
  phone = phonelink.add('C:\Program Files\Vizard25\resources/phone.3ds')
  avatar.phone = phone
  phone.scale(1.5,1.5,1.5)
  phone.rotate(-90,0,-90)
  phone.translate(0,0.03,0.02)
  phonelink.link(hand)
 else:
  cameralink = viz.add(viz.GROUP)  #for camera
  camera = cameralink.add('camera.WRL')
  avatar.camera = camera
  camera.scale(.0005,.0005,.0005)
  camera.translate(0,-.25,.17)
  camera.rotate(180)
  cameralink.link(neck)
Code:
for x in range(0,3):
 if x == 0:
  male = viz.add(people[0])
#  male.scale(.10,.10,.10)
  male.face(faces[0])
  hand = male.getbone('skel_HandRF')
  neck = male.getbone('skel_Neck')
  GetWeapon(male,0)
  #phonelink.link(hand)
  male.tag = 0
  male.threatening = TRUE
  male.appearance = 0
  male.facepic = 0 
 elif x == 1:
  male = viz.add(people[1])
  male.scale(.11,.11,.11)
  hand = male.getbone('skel_HandRF')
  neck = male.getbone('skel_Neck')
  GetWeapon(male,1)
  #cameralink.link(neck)
  male.tag = 1
  male.threatening = FALSE
  male.appearance = 0
  male.facepic = 0
 elif x ==2:
  male = viz.add(people[2])
  male.scale(.11,.11,.11)
  hand = male.getbone('skel_HandRF')
  neck = male.getbone('skel_Neck')
  GetWeapon(male,0)
  #gunlink.link(hand)
  #male.face(faces[1])
  male.tag = 2
  male.threatening = FALSE
  male.appearance = 0
  male.facepic = 0
 male.translate(3*x,-10,10)
 male.rotate(180)
 #Add the avatar to the waiting and lemming list
 waitlist.append(male)
 characters.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 01:59 AM.


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