def initAvatars(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawAvatar = vizconnect.getRawAvatarDict() #VC: initialize a new avatar _name = 'male' if vizconnect.isPendingInit('avatar', _name, initFlag, initList): #VC: init the raw object if initFlag & vizconnect.INIT_RAW: #VC: create the raw object avatar = viz.add('vcc_male.cfg') avatar._bodyPartDict = {} avatar._handModelDict = {} rawAvatar[_name] = avatar #VC: init the wrapper (DO NOT EDIT) if initFlag & vizconnect.INIT_WRAPPERS: vizconnect.addAvatar(rawAvatar[_name], _name, make='Complete Characters', model='Male') #VC: init the animator if initFlag & vizconnect.INIT_ANIMATOR: # need to get the raw tracker dict for animating the avatars from vizconnect.util.avatar import animator from vizconnect.util.avatar import skeleton # get the skeleton from the avatar _skeleton = skeleton.CompleteCharacters(rawAvatar[_name]) #VC: set which trackers animate which body part # format is: bone: (tracker, parent, degrees of freedom used) _trackerAssignmentDict = { vizconnect.AVATAR_HEAD: (vizconnect.getTracker('look_at2').getNode3d(), None, vizconnect.DOF_6DOF), vizconnect.AVATAR_L_FOREARM: (vizconnect.getTracker('marker6').getNode3d(), None, vizconnect.DOF_6DOF), vizconnect.AVATAR_L_HAND: (vizconnect.getTracker('look_at').getNode3d(), None, vizconnect.DOF_6DOF), vizconnect.AVATAR_R_HAND: (vizconnect.getTracker('look_at3').getNode3d(), None, vizconnect.DOF_6DOF), } #VC: create the raw object _rawAnimator = animator.InverseKinematics(rawAvatar[_name], _skeleton, _trackerAssignmentDict) #VC: set animator in wrapper (DO NOT EDIT) vizconnect.getAvatar(_name).setAnimator(_rawAnimator, make='WorldViz', model='Inverse Kinematics') #VC: return values can be modified here return None
def initAvatars(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawAvatar = vizconnect.getRawAvatarDict() #VC: initialize a new avatar _name = 'female' if vizconnect.isPendingInit('avatar', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: create the raw object avatar = viz.add('vcc_female.cfg') avatar._bodyPartDict = {} avatar._handModelDict = {} rawAvatar[_name] = avatar #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addAvatar(rawAvatar[_name], _name, make='Complete Characters', model='Female') #VC: init the animator if initFlag&vizconnect.INIT_ANIMATOR: # need to get the raw tracker dict for animating the avatars from vizconnect.util.avatar import animator from vizconnect.util.avatar import skeleton # get the skeleton from the avatar _skeleton = skeleton.CompleteCharacters(rawAvatar[_name]) #VC: set which trackers animate which body part # format is: bone: (tracker, parent, degrees of freedom used) _trackerAssignmentDict = { vizconnect.AVATAR_HEAD:(vizconnect.getTracker('rift_orientation_tracker').getNode3d(), None, vizconnect.DOF_ORI), } #VC: create the raw object _rawAnimator = animator.InverseKinematics(rawAvatar[_name], _skeleton, _trackerAssignmentDict) #VC: set animator in wrapper (DO NOT EDIT) vizconnect.getAvatar(_name).setAnimator(_rawAnimator, make='WorldViz', model='Inverse Kinematics') #VC: init the mappings for the wrapper if initFlag&vizconnect.INIT_WRAPPER_MAPPINGS: #VC: on-state mappings if initFlag&vizconnect.INIT_MAPPINGS_ON_STATE: vizconnect.getAvatar(_name).setOnStateEventList([ vizconnect.onstate(lambda rawInput: rawInput['joystick'].isButtonDown(3), vizconnect.getAvatar(_name).setVisible),# make=Generic, model=Joystick, name=joystick, signal=Button 3 ]) #VC: set the parent of the node if initFlag&vizconnect.INIT_PARENTS: vizconnect.getAvatar(_name).setParent(vizconnect.getTransport('walking')) #VC: return values can be modified here return None
def initAvatars(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawAvatar = vizconnect.getRawAvatarDict() #VC: initialize a new avatar _name = 'main_avatar' if vizconnect.isPendingInit('avatar', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set some parameters head = False rightHand = True leftHand = False torso = False lowerBody = False rightArm = False leftArm = False #VC: create the raw object # base avatar import vizfx avatar = vizfx.addChild('mark.cfg') avatar.disable(viz.LIGHTING) avatar._bodyPartDict = {} avatar._handModelDict = {} avatar.visible(head, r'mark_head.cmf') avatar.visible(rightHand, r'mark_hand_r.cmf') avatar.visible(leftHand, r'mark_hand_l.cmf') avatar.visible(torso, r'mark_torso.cmf') avatar.visible(lowerBody, r'mark_legs.cmf') avatar.visible(rightArm, r'mark_arm_r.cmf') avatar.visible(leftArm, r'mark_arm_l.cmf') rawAvatar[_name] = avatar #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addAvatar(rawAvatar[_name], _name, make='WorldViz', model='Mark') #VC: init the gestures if initFlag&vizconnect.INIT_GESTURES: #VC: need to get the raw input dict so we have access to signals import vizact rawInput = vizconnect.getConfiguration().getRawDict('input') #VC: gestures for the avatar's r_hand import hand def initHand(): sensor = hand.InputSensor() rawAvatar[_name].handSensor = sensor sensor.createHandRenderer = lambda *args,**kw: hand._InputDeviceRenderer(*args,**kw) def appliedGetData(): #VC: set the mappings for the gestures if rawInput['r_hand_input'].getState()&viz.MOUSEBUTTON_LEFT:# make=Generic, model=Mouse Buttons, name=r_hand_input, signal=Left Mouse Button return (hand.GESTURE_FIST, False, False)# GESTURE_FIST #VC: end gesture mappings return (hand.GESTURE_FLAT_HAND,False,False) sensor.getData = appliedGetData return hand.AvatarHandModel(rawAvatar[_name], left=False, type=hand.GLOVE_5DT, sensor=sensor) rightHand = initHand() rawAvatar[_name]._bodyPartDict[vizconnect.AVATAR_R_HAND] = rightHand rawAvatar[_name]._handModelDict[vizconnect.AVATAR_R_HAND] = rightHand #VC: gestures may change the raw avatar, so refresh the raw in the wrapper vizconnect.getAvatar(_name).setRaw(rawAvatar[_name]) #VC: init the animator if initFlag&vizconnect.INIT_ANIMATOR: # need to get the raw tracker dict for animating the avatars from vizconnect.util.avatar import animator from vizconnect.util.avatar import skeleton # get the skeleton from the avatar _skeleton = skeleton.CompleteCharactersHD(rawAvatar[_name]) #VC: set which trackers animate which body part # format is: bone: (tracker, parent, degrees of freedom used) _trackerAssignmentDict = { vizconnect.AVATAR_HEAD:(vizconnect.getTracker('head_tracker').getNode3d(), None, vizconnect.DOF_6DOF), vizconnect.AVATAR_R_HAND:(vizconnect.getTracker('r_hand_tracker').getNode3d(), vizconnect.AVATAR_HEAD, vizconnect.DOF_POS), } #VC: create the raw object _rawAnimator = animator.Direct(rawAvatar[_name], _skeleton, _trackerAssignmentDict) #VC: set animator in wrapper (DO NOT EDIT) vizconnect.getAvatar(_name).setAnimator(_rawAnimator, make='Virtual', model='Direct') #VC: set the parent of the node if initFlag&vizconnect.INIT_PARENTS: vizconnect.getAvatar(_name).setParent(vizconnect.getTransport('main_transport')) #VC: set the name of the default vizconnect.setDefault('avatar', 'main_avatar') #VC: return values can be modified here return None
def initAvatars(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawAvatar = vizconnect.getRawAvatarDict() #VC: initialize a new avatar _name = 'head_and_hand' if vizconnect.isPendingInit('avatar', _name, initFlag, initList): #VC: init the raw object if initFlag & vizconnect.INIT_RAW: #VC: set some parameters # rightHandFilename = 'glove.cfg' rightHandFilename = '' leftHandFilename = '' #VC: create the raw object # base avatar avatar = viz.addGroup() avatar._bodyPartDict = {} avatar._handModelDict = {} # head head = viz.addGroup() head.setParent(avatar) avatar._bodyPartDict[vizconnect.AVATAR_HEAD] = head # left hand if leftHandFilename: leftHand = avatar.add(leftHandFilename) avatar.leftHandFilename = leftHandFilename else: leftHand = viz.addGroup() avatar.leftHandFilename = None leftHand.setParent(avatar) avatar._bodyPartDict[vizconnect.AVATAR_L_HAND] = leftHand # right hand if rightHandFilename: rightHand = avatar.add(rightHandFilename) avatar.rightHandFilename = rightHandFilename else: rightHand = viz.addGroup() avatar.rightHandFilename = None rightHand.setParent(avatar) avatar._bodyPartDict[vizconnect.AVATAR_R_HAND] = rightHand # done rawAvatar[_name] = avatar #VC: init the wrapper (DO NOT EDIT) if initFlag & vizconnect.INIT_WRAPPERS: vizconnect.addAvatar(rawAvatar[_name], _name, make='Generic', model='Head and Hand') #VC: init the gestures if initFlag & vizconnect.INIT_GESTURES: #VC: need to get the raw input dict so we have access to signals import vizact rawInput = vizconnect.getConfiguration().getRawDict('input') #VC: gestures for the avatar's r_hand import hand # remove the old hand rightHand = rawAvatar[_name]._bodyPartDict[ vizconnect.AVATAR_R_HAND] if rightHand: rightHand.remove() # add a new hand def initHand(): sensor = hand.InputSensor() rawAvatar[_name].handSensor = sensor sensor.createHandRenderer = lambda *args, **kw: hand._InputDeviceRenderer( *args, **kw) def appliedGetData(): #VC: set the mappings for the gestures if rawInput['flystick'].isButtonDown( 0 ): # make=ART, model=Flystick, name=flystick, signal=Button 0 return (hand.GESTURE_FIST, False, False ) # GESTURE_FIST #VC: end gesture mappings return (hand.GESTURE_FLAT_HAND, False, False) sensor.getData = appliedGetData file = None if hasattr(rawAvatar[_name], "rightHandFilename"): file = rawAvatar[_name].rightHandFilename return hand.HandModel(left=False, type=hand.GLOVE_5DT, file=file, sensor=sensor) rightHand = initHand() rightHand.setParent(rawAvatar[_name]) rawAvatar[_name]._bodyPartDict[ vizconnect.AVATAR_R_HAND] = rightHand rawAvatar[_name]._handModelDict[ vizconnect.AVATAR_R_HAND] = rightHand #VC: gestures may change the raw avatar, so refresh the raw in the wrapper vizconnect.getAvatar(_name).setRaw(rawAvatar[_name]) #VC: init the animator if initFlag & vizconnect.INIT_ANIMATOR: # need to get the raw tracker dict for animating the avatars from vizconnect.util.avatar import animator from vizconnect.util.avatar import skeleton # get the skeleton from the avatar _skeleton = skeleton.Disembodied(rawAvatar[_name]) #VC: set which trackers animate which body part # format is: bone: (tracker, parent, degrees of freedom used) _trackerAssignmentDict = { vizconnect.AVATAR_HEAD: (vizconnect.getTracker('dtrack_head').getNode3d(), None, vizconnect.DOF_6DOF), vizconnect.AVATAR_R_HAND: (vizconnect.getTracker('dtrack_flystick').getNode3d(), None, vizconnect.DOF_6DOF), } #VC: create the raw object _rawAnimator = animator.Disembodied(rawAvatar[_name], _skeleton, _trackerAssignmentDict) #VC: set animator in wrapper (DO NOT EDIT) vizconnect.getAvatar(_name).setAnimator(_rawAnimator, make='Virtual', model='Disembodied') #VC: set the parent of the node if initFlag & vizconnect.INIT_PARENTS: vizconnect.getAvatar(_name).setParent( vizconnect.getGroup('cave_manual_configuration')) #VC: set the name of the default vizconnect.setDefault('avatar', 'head_and_hand') #VC: return values can be modified here return None
def initAvatars(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawAvatar = vizconnect.getRawAvatarDict() #VC: initialize a new avatar _name = 'head_and_hand' if vizconnect.isPendingInit('avatar', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set some parameters rightHandFilename = 'glove.cfg' leftHandFilename = '' #VC: create the raw object # base avatar avatar = viz.addGroup() avatar._bodyPartDict = {} avatar._handModelDict = {} # head head = viz.addGroup() head.setParent(avatar) avatar._bodyPartDict[vizconnect.AVATAR_HEAD] = head # left hand if leftHandFilename: leftHand = avatar.add(leftHandFilename) avatar.leftHandFilename = leftHandFilename else: leftHand = viz.addGroup() avatar.leftHandFilename = None leftHand.setParent(avatar) avatar._bodyPartDict[vizconnect.AVATAR_L_HAND] = leftHand # right hand if rightHandFilename: rightHand = avatar.add(rightHandFilename) avatar.rightHandFilename = rightHandFilename else: rightHand = viz.addGroup() avatar.rightHandFilename = None rightHand.setParent(avatar) avatar._bodyPartDict[vizconnect.AVATAR_R_HAND] = rightHand # done rawAvatar[_name] = avatar #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addAvatar(rawAvatar[_name], _name, make='Generic', model='Head and Hand') #VC: init the gestures if initFlag&vizconnect.INIT_GESTURES: #VC: need to get the raw input dict so we have access to signals import vizact rawInput = vizconnect.getConfiguration().getRawDict('input') #VC: gestures for the avatar's r_hand import hand # remove the old hand rightHand = rawAvatar[_name]._bodyPartDict[vizconnect.AVATAR_R_HAND] if rightHand: rightHand.remove() # add a new hand def initHand(): sensor = hand.InputSensor() rawAvatar[_name].handSensor = sensor sensor.createHandRenderer = lambda *args,**kw: hand._InputDeviceRenderer(*args,**kw) def appliedGetData(): #VC: set the mappings for the gestures if rawInput['mouse_buttons'].getState()&viz.MOUSEBUTTON_LEFT:# make=Generic, model=Mouse Buttons, name=mouse_buttons, signal=Left Mouse Button return (hand.GESTURE_FIST, False, False)# GESTURE_FIST #VC: end gesture mappings return (hand.GESTURE_FLAT_HAND,False,False) sensor.getData = appliedGetData file=None if hasattr(rawAvatar[_name], "rightHandFilename"): file = rawAvatar[_name].rightHandFilename return hand.HandModel(left=False, type=hand.GLOVE_5DT, file=file, sensor=sensor) rightHand = initHand() rightHand.setParent(rawAvatar[_name]) rawAvatar[_name]._bodyPartDict[vizconnect.AVATAR_R_HAND] = rightHand rawAvatar[_name]._handModelDict[vizconnect.AVATAR_R_HAND] = rightHand #VC: gestures may change the raw avatar, so refresh the raw in the wrapper vizconnect.getAvatar(_name).setRaw(rawAvatar[_name]) #VC: init the animator if initFlag&vizconnect.INIT_ANIMATOR: # need to get the raw tracker dict for animating the avatars from vizconnect.util.avatar import animator from vizconnect.util.avatar import skeleton # get the skeleton from the avatar _skeleton = skeleton.Disembodied(rawAvatar[_name]) #VC: set which trackers animate which body part # format is: bone: (tracker, parent, degrees of freedom used) _trackerAssignmentDict = { vizconnect.AVATAR_HEAD:(vizconnect.getTracker('mouse_and_keyboard_walking').getNode3d(), None, vizconnect.DOF_6DOF), vizconnect.AVATAR_R_HAND:(vizconnect.getTracker('mouse_scrollwheel').getNode3d(), vizconnect.AVATAR_HEAD, vizconnect.DOF_POS), } #VC: create the raw object _rawAnimator = animator.Disembodied(rawAvatar[_name], _skeleton, _trackerAssignmentDict) #VC: set animator in wrapper (DO NOT EDIT) vizconnect.getAvatar(_name).setAnimator(_rawAnimator, make='Virtual', model='Disembodied') #VC: return values can be modified here return None
def initAvatars(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawAvatar = vizconnect.getRawAvatarDict() #VC: initialize a new avatar _name = 'white_male' if vizconnect.isPendingInit('avatar', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set some parameters filename = 'C:/Users/Jeremy Bailenson/Documents/GitHub/Demos/Proteus Demo Vive/assets/models/avatars/white_male.cfg' #VC: create the raw object avatar = viz.add(filename) avatar._bodyPartDict = {} avatar._handModelDict = {} rawAvatar[_name] = avatar #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addAvatar(rawAvatar[_name], _name, make='Human', model='Auto Parse') #VC: init the animator if initFlag&vizconnect.INIT_ANIMATOR: # need to get the raw tracker dict for animating the avatars from vizconnect.util.avatar import animator from vizconnect.util.avatar import skeleton # get the skeleton from the avatar _skeleton = skeleton.HumanAutoParse(rawAvatar[_name]) #VC: set which trackers animate which body part # format is: bone: (tracker, parent, degrees of freedom used) _trackerAssignmentDict = { vizconnect.AVATAR_HEAD:(vizconnect.getTracker('steamvr_hmd_tracker').getNode3d(), None, vizconnect.DOF_6DOF), vizconnect.AVATAR_L_FOREARM:(vizconnect.getTracker('steamvr_controller_tracker').getNode3d(), None, vizconnect.DOF_6DOF), vizconnect.AVATAR_R_FOREARM:(vizconnect.getTracker('steamvr_controller_tracker2').getNode3d(), None, vizconnect.DOF_6DOF), } #VC: create the raw object _rawAnimator = animator.InverseKinematics(rawAvatar[_name], _skeleton, _trackerAssignmentDict) #VC: set animator in wrapper (DO NOT EDIT) vizconnect.getAvatar(_name).setAnimator(_rawAnimator, make='WorldViz', model='Inverse Kinematics') #VC: initialize a new avatar _name = 'black_female' if vizconnect.isPendingInit('avatar', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set some parameters filename = 'C:/Users/Jeremy Bailenson/Documents/GitHub/Demos/Proteus Demo Vive/assets/models/avatars/black_female.cfg' #VC: create the raw object avatar = viz.add(filename) avatar._bodyPartDict = {} avatar._handModelDict = {} rawAvatar[_name] = avatar #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addAvatar(rawAvatar[_name], _name, make='Human', model='Auto Parse') #VC: init the animator if initFlag&vizconnect.INIT_ANIMATOR: # need to get the raw tracker dict for animating the avatars from vizconnect.util.avatar import animator from vizconnect.util.avatar import skeleton # get the skeleton from the avatar _skeleton = skeleton.HumanAutoParse(rawAvatar[_name]) #VC: set which trackers animate which body part # format is: bone: (tracker, parent, degrees of freedom used) _trackerAssignmentDict = { vizconnect.AVATAR_HEAD:(vizconnect.getTracker('steamvr_hmd_tracker').getNode3d(), None, vizconnect.DOF_6DOF), vizconnect.AVATAR_L_FOREARM:(vizconnect.getTracker('steamvr_controller_tracker').getNode3d(), None, vizconnect.DOF_6DOF), vizconnect.AVATAR_R_FOREARM:(vizconnect.getTracker('steamvr_controller_tracker2').getNode3d(), None, vizconnect.DOF_6DOF), } #VC: create the raw object _rawAnimator = animator.InverseKinematics(rawAvatar[_name], _skeleton, _trackerAssignmentDict) #VC: set animator in wrapper (DO NOT EDIT) vizconnect.getAvatar(_name).setAnimator(_rawAnimator, make='WorldViz', model='Inverse Kinematics') #VC: initialize a new avatar _name = 'old_white_male' if vizconnect.isPendingInit('avatar', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set some parameters filename = 'C:/Users/Jeremy Bailenson/Documents/GitHub/Demos/Proteus Demo Vive/assets/models/avatars/old_white_male.cfg' #VC: create the raw object avatar = viz.add(filename) avatar._bodyPartDict = {} avatar._handModelDict = {} rawAvatar[_name] = avatar #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addAvatar(rawAvatar[_name], _name, make='Human', model='Auto Parse') #VC: init the animator if initFlag&vizconnect.INIT_ANIMATOR: # need to get the raw tracker dict for animating the avatars from vizconnect.util.avatar import animator from vizconnect.util.avatar import skeleton # get the skeleton from the avatar _skeleton = skeleton.HumanAutoParse(rawAvatar[_name]) #VC: set which trackers animate which body part # format is: bone: (tracker, parent, degrees of freedom used) _trackerAssignmentDict = { vizconnect.AVATAR_HEAD:(vizconnect.getTracker('steamvr_hmd_tracker').getNode3d(), None, vizconnect.DOF_6DOF), vizconnect.AVATAR_L_FOREARM:(vizconnect.getTracker('steamvr_controller_tracker').getNode3d(), None, vizconnect.DOF_6DOF), vizconnect.AVATAR_R_FOREARM:(vizconnect.getTracker('steamvr_controller_tracker2').getNode3d(), None, vizconnect.DOF_6DOF), } #VC: create the raw object _rawAnimator = animator.InverseKinematics(rawAvatar[_name], _skeleton, _trackerAssignmentDict) #VC: set animator in wrapper (DO NOT EDIT) vizconnect.getAvatar(_name).setAnimator(_rawAnimator, make='WorldViz', model='Inverse Kinematics') #VC: initialize a new avatar _name = 'black_male' if vizconnect.isPendingInit('avatar', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set some parameters filename = 'C:/Users/Jeremy Bailenson/Documents/GitHub/Demos/Proteus Demo Vive/assets/models/avatars/Male/CC2_m016_hipoly_A0.cfg' #VC: create the raw object avatar = viz.add(filename) avatar._bodyPartDict = {} avatar._handModelDict = {} rawAvatar[_name] = avatar #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addAvatar(rawAvatar[_name], _name, make='Human', model='Auto Parse') #VC: init the animator if initFlag&vizconnect.INIT_ANIMATOR: # need to get the raw tracker dict for animating the avatars from vizconnect.util.avatar import animator from vizconnect.util.avatar import skeleton # get the skeleton from the avatar _skeleton = skeleton.HumanAutoParse(rawAvatar[_name]) #VC: set which trackers animate which body part # format is: bone: (tracker, parent, degrees of freedom used) _trackerAssignmentDict = { vizconnect.AVATAR_HEAD:(vizconnect.getTracker('steamvr_hmd_tracker').getNode3d(), None, vizconnect.DOF_6DOF), vizconnect.AVATAR_L_FOREARM:(vizconnect.getTracker('steamvr_controller_tracker').getNode3d(), None, vizconnect.DOF_6DOF), vizconnect.AVATAR_R_FOREARM:(vizconnect.getTracker('steamvr_controller_tracker2').getNode3d(), None, vizconnect.DOF_6DOF), } #VC: create the raw object _rawAnimator = animator.InverseKinematics(rawAvatar[_name], _skeleton, _trackerAssignmentDict) #VC: set animator in wrapper (DO NOT EDIT) vizconnect.getAvatar(_name).setAnimator(_rawAnimator, make='WorldViz', model='Inverse Kinematics') #VC: initialize a new avatar _name = 'blonde_female' if vizconnect.isPendingInit('avatar', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set some parameters filename = 'C:/Users/Jeremy Bailenson/Documents/GitHub/Demos/Proteus Demo Vive/assets/models/avatars/female/CC2_f010_hipoly_A0.cfg' #VC: create the raw object avatar = viz.add(filename) avatar._bodyPartDict = {} avatar._handModelDict = {} rawAvatar[_name] = avatar #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addAvatar(rawAvatar[_name], _name, make='Human', model='Auto Parse') #VC: init the animator if initFlag&vizconnect.INIT_ANIMATOR: # need to get the raw tracker dict for animating the avatars from vizconnect.util.avatar import animator from vizconnect.util.avatar import skeleton # get the skeleton from the avatar _skeleton = skeleton.HumanAutoParse(rawAvatar[_name]) #VC: set which trackers animate which body part # format is: bone: (tracker, parent, degrees of freedom used) _trackerAssignmentDict = { vizconnect.AVATAR_HEAD:(vizconnect.getTracker('steamvr_hmd_tracker').getNode3d(), None, vizconnect.DOF_6DOF), vizconnect.AVATAR_L_FOREARM:(vizconnect.getTracker('steamvr_controller_tracker').getNode3d(), None, vizconnect.DOF_6DOF), vizconnect.AVATAR_R_FOREARM:(vizconnect.getTracker('steamvr_controller_tracker2').getNode3d(), None, vizconnect.DOF_6DOF), } #VC: create the raw object _rawAnimator = animator.InverseKinematics(rawAvatar[_name], _skeleton, _trackerAssignmentDict) #VC: set animator in wrapper (DO NOT EDIT) vizconnect.getAvatar(_name).setAnimator(_rawAnimator, make='WorldViz', model='Inverse Kinematics') #VC: return values can be modified here return None
def initAvatars(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawAvatar = vizconnect.getRawAvatarDict() #VC: initialize a new avatar _name = 'head_and_hand' if vizconnect.isPendingInit('avatar', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set some parameters rightHandFilename = 'glove.cfg' leftHandFilename = '' #VC: create the raw object # base avatar avatar = viz.addGroup() avatar._bodyPartDict = {} avatar._handModelDict = {} # head head = viz.addGroup() head.setParent(avatar) avatar._bodyPartDict[vizconnect.AVATAR_HEAD] = head # left hand if leftHandFilename: leftHand = avatar.add(leftHandFilename) avatar.leftHandFilename = leftHandFilename else: leftHand = viz.addGroup() avatar.leftHandFilename = None leftHand.setParent(avatar) avatar._bodyPartDict[vizconnect.AVATAR_L_HAND] = leftHand # right hand if rightHandFilename: rightHand = avatar.add(rightHandFilename) avatar.rightHandFilename = rightHandFilename else: rightHand = viz.addGroup() avatar.rightHandFilename = None rightHand.setParent(avatar) avatar._bodyPartDict[vizconnect.AVATAR_R_HAND] = rightHand # done rawAvatar[_name] = avatar #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addAvatar(rawAvatar[_name], _name, make='Generic', model='Head and Hand') #VC: init the animator if initFlag&vizconnect.INIT_ANIMATOR: # need to get the raw tracker dict for animating the avatars from vizconnect.util.avatar import animator from vizconnect.util.avatar import skeleton # get the skeleton from the avatar _skeleton = skeleton.Disembodied(rawAvatar[_name]) #VC: set which trackers animate which body part # format is: bone: (tracker, parent, degrees of freedom used) _trackerAssignmentDict = { vizconnect.AVATAR_HEAD:(vizconnect.getTracker('headtracker').getNode3d(), None, vizconnect.DOF_6DOF), vizconnect.AVATAR_R_HAND:(vizconnect.getTracker('wandtracker').getNode3d(), None, vizconnect.DOF_6DOF), } #VC: create the raw object _rawAnimator = animator.Disembodied(rawAvatar[_name], _skeleton, _trackerAssignmentDict) #VC: set animator in wrapper (DO NOT EDIT) vizconnect.getAvatar(_name).setAnimator(_rawAnimator, make='Virtual', model='Disembodied') #VC: set the parent of the node if initFlag&vizconnect.INIT_PARENTS: vizconnect.getAvatar(_name).setParent(vizconnect.getGroup('cave_manual_configuration')) #VC: return values can be modified here return None
def initAvatars(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawAvatar = vizconnect.getRawAvatarDict() #VC: initialize a new avatar _name = 'main_avatar' if vizconnect.isPendingInit('avatar', _name, initFlag, initList): #VC: init the raw object if initFlag&vizconnect.INIT_RAW: #VC: set some parameters rightHandFilename = 'glove.cfg' leftHandFilename = '' #VC: create the raw object # base avatar avatar = viz.addGroup() avatar._bodyPartDict = {} avatar._handModelDict = {} # head head = viz.addGroup() head.setParent(avatar) avatar._bodyPartDict[vizconnect.AVATAR_HEAD] = head # left hand if leftHandFilename: leftHand = avatar.add(leftHandFilename) avatar.leftHandFilename = leftHandFilename else: leftHand = viz.addGroup() avatar.leftHandFilename = None leftHand.setParent(avatar) avatar._bodyPartDict[vizconnect.AVATAR_L_HAND] = leftHand # right hand if rightHandFilename: rightHand = avatar.add(rightHandFilename) avatar.rightHandFilename = rightHandFilename else: rightHand = viz.addGroup() avatar.rightHandFilename = None rightHand.setParent(avatar) avatar._bodyPartDict[vizconnect.AVATAR_R_HAND] = rightHand # done rawAvatar[_name] = avatar #VC: init the wrapper (DO NOT EDIT) if initFlag&vizconnect.INIT_WRAPPERS: vizconnect.addAvatar(rawAvatar[_name], _name, make='Generic', model='Head and Hand') #VC: init the animator if initFlag&vizconnect.INIT_ANIMATOR: # need to get the raw tracker dict for animating the avatars from vizconnect.util.avatar import animator from vizconnect.util.avatar import skeleton # get the skeleton from the avatar _skeleton = skeleton.Disembodied(rawAvatar[_name]) #VC: set which trackers animate which body part # format is: bone: (tracker, parent, degrees of freedom used) _trackerAssignmentDict = { vizconnect.AVATAR_HEAD:(vizconnect.getTracker('head_tracker').getNode3d(), None, vizconnect.DOF_6DOF), } #VC: create the raw object _rawAnimator = animator.Disembodied(rawAvatar[_name], _skeleton, _trackerAssignmentDict) #VC: set animator in wrapper (DO NOT EDIT) vizconnect.getAvatar(_name).setAnimator(_rawAnimator, make='Virtual', model='Disembodied') #VC: set the parent of the node if initFlag&vizconnect.INIT_PARENTS: vizconnect.getAvatar(_name).setParent(vizconnect.getTransport('main_transport')) #VC: set the name of the default vizconnect.setDefault('avatar', 'main_avatar') #VC: return values can be modified here return None
def initAvatars(initFlag=vizconnect.INIT_INDEPENDENT, initList=None): #VC: place any general initialization code here rawAvatar = vizconnect.getRawAvatarDict() #VC: initialize a new avatar _name = 'main_avatar' if vizconnect.isPendingInit('avatar', _name, initFlag, initList): #VC: init the raw object if initFlag & vizconnect.INIT_RAW: #VC: set some parameters head = False rightHand = False leftHand = False torso = False lowerBody = False rightArm = False leftArm = False #VC: create the raw object # base avatar import vizfx avatar = vizfx.addChild('mark.cfg') avatar._bodyPartDict = {} avatar._handModelDict = {} avatar.visible(head, r'mark_head.cmf') avatar.visible(rightHand, r'mark_hand_r.cmf') avatar.visible(leftHand, r'mark_hand_l.cmf') avatar.visible(torso, r'mark_torso.cmf') avatar.visible(lowerBody, r'mark_legs.cmf') avatar.visible(rightArm, r'mark_arm_r.cmf') avatar.visible(leftArm, r'mark_arm_l.cmf') rawAvatar[_name] = avatar #VC: init the wrapper (DO NOT EDIT) if initFlag & vizconnect.INIT_WRAPPERS: vizconnect.addAvatar(rawAvatar[_name], _name, make='WorldViz', model='Mark') #VC: init the animator if initFlag & vizconnect.INIT_ANIMATOR: # need to get the raw tracker dict for animating the avatars from vizconnect.util.avatar import animator from vizconnect.util.avatar import skeleton # get the skeleton from the avatar _skeleton = skeleton.CompleteCharactersHD(rawAvatar[_name]) #VC: set which trackers animate which body part # format is: bone: (tracker, parent, degrees of freedom used) _trackerAssignmentDict = { vizconnect.AVATAR_HEAD: (vizconnect.getTracker('head_tracker').getNode3d(), None, vizconnect.DOF_POS), vizconnect.AVATAR_R_HAND: (vizconnect.getTracker('r_hand_tracker').getNode3d(), None, vizconnect.DOF_POS), } #VC: create the raw object _rawAnimator = animator.Direct(rawAvatar[_name], _skeleton, _trackerAssignmentDict) #VC: set animator in wrapper (DO NOT EDIT) vizconnect.getAvatar(_name).setAnimator(_rawAnimator, make='Virtual', model='Direct') #VC: set the parent of the node if initFlag & vizconnect.INIT_PARENTS: vizconnect.getAvatar(_name).setParent( vizconnect.getGroup('main_display')) #VC: set the name of the default vizconnect.setDefault('avatar', 'main_avatar') #VC: return values can be modified here return None