def luigiActions(): yield viztask.waitTime(53) yield viztask.addAction(luigi, vizact.walkTo([-0, 0, 4])) yield viztask.addAction(luigi, vizact.walkTo([-1, 0, 3], turnInPlace=True)) yield viztask.addAction(luigi, vizact.walkTo([0, 0, 2])) yield viztask.addAction(luigi, vizact.turn(0, 220)) yield viztask.addAction(luigi, vizact.animation(4))
def fadeAndAppear(): ball = viz.add('soccerball.ive') ball.setPosition(2,2,0) yield viztask.addAction( ball, vizact.fadeTo(0,time=2) ) print 'done fading' yield viztask.addAction( ball, vizact.fadeTo(1,time=2) ) print 'done appearing'
def walk(): while (True) : yield viztask.addAction(cat,vizact.walkTo([2.8, 0, -3], walkSpeed = 1.5, turnSpeed = 1, walkAnim = 4)) yield viztask.waitTime(1.5) yield look1() yield viztask.addAction(cat,vizact.walkTo([-2.8, 0, -3], walkSpeed = 1.5, turnSpeed = 1, walkAnim = 4)) yield viztask.waitTime(1.5) yield look2()
def myTask(): while True: question_text.message('Hit the spacebar to begin.') yield viztask.waitKeyDown(' ') female.state(5) yield viztask.waitTime(1) yield viztask.addAction(male, vizact.walkTo([-1,-0,0])) male.state(5) yield mySubTask() male.state(9) yield viztask.addAction(female,vizact.animation(6)) male.addAction( vizact.walkTo( [2,0,-1],2.5,90,11 ) )
def go(): man.state(162) woman.state(35) # doesn't work yield viztask.addAction(woman, vizact.walkTo([1.35,0,-1.35])) yield viztask.addAction(man, vizact.animation(11)) yield viztask.addAction(woman, vizact.turn(-145)) # woman.state(86) # woman.state(142) man.state(7) while True: # goes to a weird animatin in-between yield viztask.addAction(woman, vizact.animation(143)) yield viztask.addAction(woman, vizact.animation(144))
def CycleAlertsTask (self): self._cycler = None #the next item in the list to display (starts with last) fade_out = vizact.fadeTo(0, 1, time=0.5, interpolate=vizact.easeOutStrong) fade_in = vizact.fadeTo(1, 0, time=0.5, interpolate=vizact.easeOutStrong) #set all alerts on map to 100% opaque so that they don't stay semi-transparent for i in [a for m, a in self._alerts.iteritems() if m != 'info']: a.alpha(1) while True: data = yield viztask.waitDirector(self.GetNextMessage) nextKey = data.returnValue if nextKey == 'info': #not verified anymore because info not in _messages self._infoPanel.setText(self._messages[nextKey]) else: self.DisplayAlert(self._messages[nextKey]) if nextKey != 'info': alertObj = self._alerts[nextKey] yield viztask.addAction(alertObj, fade_out) yield viztask.addAction(alertObj, fade_in) yield viztask.addAction(alertObj, fade_out) yield viztask.addAction(alertObj, fade_in) yield viztask.addAction(alertObj, fade_out) yield viztask.addAction(alertObj, fade_in) yield viztask.addAction(alertObj, fade_out) yield viztask.addAction(alertObj, fade_in) else: yield viztask.waitTime(5)
def makeMove(): walk_over = vizact.walkTo([-.5,0,-2.2]) yield viztask.addAction( female, walk_over ) female.addAction(vizact.animation(2)) wait = vizact.waittime(3) yield male.addAction(wait) react()
def H2CO3formation(): global bigCO2, bigH2O, h2co3molecule, co2Path, lowPolyMole, highPolyMole, h2co3FormationTriggered h2co3FormationTriggered = True viz.sendEvent(globals_oa.H2CO3_COMPLETION_EVENT) #none of the following calls work to get the correct 3d position, phew! # x,y,z = bigH2O.getPosition(viz.ABS_GLOBAL) # x,y,z = bigH2O.getBoundingBox().center #hardcoded value below, until the sunny day when Worldviz gets us a call for the correct position of a 3d node! co2Path.remove() x,y,z = globals_oa.h2OLocationUntilWeChangeAgain[0], globals_oa.h2OLocationUntilWeChangeAgain[1], globals_oa.h2OLocationUntilWeChangeAgain[2] print x,y,z moveToH2O = vizact.moveTo([x,y,z] , speed = .75) yield viztask.addAction(bigCO2, moveToH2O) #yield viztask.waitTime(.05) #Fade molecules from bigCO2 and bigH2O to H2CO3 animation h2co3molecule.setPosition(globals_oa.h2CO3LocationUntilWeChangeAgain) lowPolyMole.enable(viz.RENDERING) highPolyMole.disable(viz.RENDERING) h2co3molecule.visible(viz.ON) h2co3molecule.setAnimationTime(8.9) #starts animation at 17.8 seconds # h2co3molecule.setAnimationSpeed(0.1) h2co3molecule.setAnimationLoopMode(0) # viztask.waitTime(.5) fadeOut = vizact.fadeTo(0, time=1) lowPolyMole.addAction(fadeOut) bigH2O.addAction(fadeOut) yield viztask.waitTime(5) bigCO2.visible(viz.OFF) bigH2O.visible(viz.OFF)
def run(self): exp = self.block.experiment lf = exp.left_finger rf = exp.right_finger # wait for the subject to touch the target sphere. yield self.block.experiment.wait_for_target() # target touched, now figure out which hand is doing the tracing. left_is_closer = distance(lf, exp.target) < distance(rf, exp.target) finger = lf if left_is_closer else rf self.trace_color = (1, 0, 0) if left_is_closer else (0, 1, 0) self.trace_name = 'left' if left_is_closer else 'right' # animate the target along the path, recording mocap data as we go. start = viz.tick() for i, v in enumerate(self.vertices): # ramp up the speed linearly from 0. s = min(1, 0.1 * (i+1)) * self.speed yield viztask.addAction(exp.target, vizact.moveTo(v, speed=s)) # keep track of the position of the tracing finger. finger_position = finger.getPosition() self.trace.append(finger_position) # record values from the simulation and from the mocap. fields = [i, viz.tick() - start] fields.extend(exp.target.getPosition()) fields.extend(finger_position) fields.extend(exp.head.get_pose().pos) for _, marker in sorted(exp.mocap.get_markers().iteritems()): fields.extend(marker.pos) fields.append(marker.cond) self.records.append(fields)
def collision( self ): #self.next_point = [self.next_point[0] - .1, 0, self.next_point[2] - .1] #get_quadrant(self.avatar.getPosition()).get_random_walk()#[self.avatar.getPosition()[0], 0, self.avatar.getPosition()[2] - 0.05] yield viztask.addAction(self.avatar, vizact.waittime(0.5)) #self.avatar.lookat(self.next_point) #yield viztask.addAction(self.avatar, vizact.waittime(1)) self.coll = 0 viztask.schedule(self.walk_around())
def walkToFemale(): yield viztask.addAction(male, walkToFaceFemale) female.state(29) male.lookAt(FEMALE_POSITION) male.runAction(vizact.animation(35)) yield viztask.waitTime(4) yield viztask.runAction(male, walkNextToFemale) female.state(3) male.runAction(vizact.animation(3))
def mytask(): shortcue = onlinecueInitial(0.01) cue = cueInitial(cuelen) for cueLoop in range(len(cueseries)): series = cueseries[cueLoop] for i in series: yield viztask.addAction(squares['square' + str(i)], cue) #myserial.serialWrite((i+1)) triggerWrite(i) yield stistage()
def mytask(): counter = 0 while True: counter += 1 cue = onlinecueInitial(0.01) #serial.serialWrite(counter) yield viztask.addAction(squares['square' + str(1)], cue) yield stistage() if counter > 250: counter = 0
def moveCO2toH2O(co2): global h2omodels x,y,z = (h2omodels[0]).getPosition() x += .5 print "location: ", x, y, z moveToH2O = vizact.moveTo([x,y,z] , speed = 1) yield viztask.addAction(co2, moveToH2O) print "should be moving!" obj.visible(viz.OFF) h2omodels[0].visible(viz.OFF) h2omodels.remove(h2omodels[0]) NUM_H2O -= 1
def walkAndAnimate(): while True: # yield waits until a task is finished before progressing to the next one # walks to the left side of the user, by the bench yield viztask.addAction(manuel, vizact.walkTo([2.4, 0, 2.57996], walkSpeed=2)) yield viztask.addAction(manuel, vizact.turn(-45, 220)) # change the position and rotation of the linked guitar link.setOffset([-0.5, 0.05, -0]) link.setEuler([-45, 0, 70]) # pauses animations for 13 seconds so the guitar playing animation is in sync with audio yield viztask.waitTime(13) # locking of bones and setting their positions/rotations so left arm of 'manuel' will 'play' the guitar upperarm = manuel.getbone('Bip01 L UpperArm') upperarm.lock() upperarm.setEuler(0, 0, 0) forearm = manuel.getBone('Bip01 L Forearm') forearm.lock() forearm.setEuler(0, 0, -120) hand = manuel.getBone('Bip01 L Hand') hand.lock() hand.setEuler(0, 180, 45) #luigi.addAction(vizact.animation(4,speed =1)) for num in range(0, 11): yield viztask.addAction(manuel, vizact.animation(4)) #unlocks bones upperarm.unlock() forearm.unlock() hand.unlock() # kill task when done animationTask.kill()
def myTask(): #As long as the task is running . . . while True: question_text.message( 'Hit the spacebar to begin.' ) #Wait for a keypress. yield viztask.waitKeyDown( ' ' ) #Animate the female. female.state( 5 ) #Wait for a second. yield viztask.waitTime( 1 ) #Make the male walk and wait for him to finish the action. yield viztask.addAction( male, vizact.walkTo( [-1,0,0] ) ) #Make the male dance. male.state( 5 ) #Wait for a sub task to finish. yield mySubTask() #Give the male a new animation. male.state(9) #Give the female a new animation and wait for it to finish. yield viztask.addAction( female, vizact.animation(6) ) #Make the male run. male.addAction( vizact.walkTo( [2,0,-1],2.5,90,11 ) )
def moveCO2toH2O(co2): print "in moveCO2toH20", co2 global h2omodels, NUM_H2O x, y, z = (h2omodels[0]).getPosition() x += 0.3 moveToH2O = vizact.moveTo([x, y, z], speed=0.75) print x, y, z # yield viztask.addAction( ball, vizact.fadeTo(1,time=2) ) yield viztask.addAction(co2, vizact.moveTo([x, y, z], speed=2)) co2.visible(viz.OFF) h2omodels[0].visible(viz.OFF) h2omodels.remove(h2omodels[0]) NUM_H2O -= 1
def walk_around( self ): global quadrants if random.random() > 1:#0.3: walk = vizact.walkTo(self.next_point) else: walk = vizact.walkTo(self.next_point, random.uniform(4, 5), 90) #change everyone else speed here #print self.next_point yield viztask.addAction(self.avatar, walk) self.next_point = get_quadrant(self.avatar.getPosition()).get_random_walk() if self.coll == 0: ##print "no collision" viztask.schedule(self.walk_around())
def start_custom_walk(self): walk = vizact.walkTo(self.next_point, self.next_speed, 90) yield viztask.addAction(self.avatar, walk) if(self.place_points < len(self.points)): self.next_point = self.points[self.place_points][0] self.next_speed = self.points[self.place_points][1] self.place_points += 1 else: self.next_point = get_quadrant(self.avatar.getPosition()).get_random_walk() self.next_speed = random.uniform(4, 5) #change tophat speed here if self.coll == 0: ##print "no collision" viztask.schedule(self.start_custom_walk())
def setup(self): vrlab.sounds.cowbell.play() self.path = self.draw(self.vertices) self.path.color(0, 0, 0) yield viztask.waitTime(1) # move the last few frames to show target direction and speed. target = self.block.experiment.target target.setPosition(self.vertices[-10]) for v in self.vertices[-10:]: yield viztask.addAction( target, vizact.moveTo(v, speed=self.speed)) target.setPosition(self.vertices[0])
def moveCO2toH2O(co2): print "in moveCO2toH20", co2 global h2omodels, NUM_H2O x,y,z = (h2omodels[0]).getPosition() x += .3 moveToH2O = vizact.moveTo([x,y,z] , speed = .75) print x,y,z #yield viztask.addAction( ball, vizact.fadeTo(1,time=2) ) yield viztask.addAction(co2, vizact.moveTo([x,y,z],speed = 2)) print "should be moving!" #yield viztask.waitTime(2) "before turning off co2" co2.visible(viz.OFF) h2omodels[0].visible(viz.OFF) "before removing h20" h2omodels.remove(h2omodels[0]) NUM_H2O -= 1
def start_custom_walk(self): #self.avatar.lookat(self.next_point) walk = vizact.walkTo(self.next_point, self.next_speed*self.speedMultiplier, 270*self.speedMultiplier) yield viztask.addAction(self.avatar, walk) theq,index = self.check_quadrants() if(self.place_points < len(self.points)): self.next_point = self.points[self.place_points][0] self.next_speed = self.points[self.place_points][1] self.save_path.addPoint(self.next_point, self.next_speed) self.place_points += 1 elif theq != -1: self.myquadrants[index] = True self.next_point = theq.get_random_walk() self.next_speed = get_next_speed() #change tophat speed here self.save_path.addPoint(self.next_point, self.next_speed) if self.coll == 0: viztask.schedule(self.start_custom_walk())
def H2CO3formation(): global bigCO2, bigH2O, h2co3molecule x, y, z = bigH2O.getPosition() x -= 0.5 moveToH2O = vizact.moveTo([x, y, z], speed=0.75) yield viztask.addAction(bigCO2, moveToH2O) # yield viztask.waitTime(.05) h2co3_x = x + 1.5 h2co3_y = y + 0.18 h2co3_z = z + 0.05 h2co3molecule.setPosition(h2co3_x, h2co3_y, h2co3_z) # Fade molecules from bigCO2 and bigH2O to H2CO3 animation fadeOut = vizact.fadeTo(0, 0.5) h2co3molecule.visible(viz.ON) h2co3molecule.setAnimationTime(8.9) # starts animation at 17.8 seconds h2co3molecule.setAnimationLoopMode(0) viztask.waitTime(0.5) bigCO2.visible(viz.OFF) bigH2O.visible(viz.OFF)
def mytask(): yield onlineStiStage() triggerSeries = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 3, 5, 7, 9, 11, 0, 2, 4, 6, 8, 10 ] for triggernum in triggerSeries: counter = 0 currentpos = position[str(triggernum)] trigger = vizshape.addSphere( radius=0.15, slices=20, stacks=20, axis=vizshape.AXIS_Y, pos=[currentpos[0], currentpos[1] - 0.9, currentpos[2]]) trigger.color(viz.RED) yield viztask.addAction( trigger, timeCountActionInitial(triggerNum=triggernum, timeLength=10)) trigger.remove()
def walk_around( self ): global quadrants #self.avatar.lookat(self.next_point) ##if random.random() > 1: ##walk = vizact.walkTo(self.next_point) ##else: walk = vizact.walkTo(self.next_point, self.next_speed*self.speedMultiplier, 270*self.speedMultiplier) #change everyone else speed here # this makes the person walk to the next point yield viztask.addAction(self.avatar, walk) [theq,index] = self.check_quadrants() if theq != -1: self.next_point = theq.get_random_walk() self.next_speed = get_next_speed() self.save_path.addPoint(self.next_point, self.next_speed) # self.coll == 0 always for now if self.coll == 0: viztask.schedule(self.walk_around())
def mechanics(self): """tutorial mechanics: moves the dog outline around the environment and waits for the dog to be snapped to it before preforming the next action.""" if self.iterations == 0: # setting conditions for position transformations along single axis # model.pointer.setParent(viz.WORLD) config.orientationVector = [0, 0, 0] proxList.append(self.dogCenter) # elif self.iterations ==3: # #setting conditions for position transformations along all axes # proxList.remove(self.dogCenter) # elif self.iterations==4: # #setting conditinos for angular transformations # proxList.append(self.dogCenter) # config.orientationVector = self.origOrienVec # config.positionVector = [0,0,0] ## model.pointer.setPosition(0,1,-1) ## model.pointer.color(0,0,5) elif self.iterations == 3: # setting conditions for positional and angular transformations # model.pointer.color(self.startColor) # model.pointer.setParent(model.display.camcenter) proxList.remove(self.dogCenter) config.orientationVector = self.origOrienVec config.positionVector = self.origPosVec if self.iterations <= 0: # X AXIS POS TRANSFORMATION config.positionVector = [0.0001, 0, 0] recordData.event(event="ROUND " + str(self.iterations), result="move along x-axis") randomPos = [4 * (random.random() - 0.5), 0, 0] self.movePos = vizact.move(randomPos[0], randomPos[1], randomPos[2], time=animateOutline) yield viztask.waitTime(1) yield viztask.addAction(self.outlineCenter, self.movePos) elif self.iterations > 0 and self.iterations <= 1: # Y AXIS POS TRANS config.positionVector = [0, 0.0001, 0] recordData.event(event="ROUND " + str(self.iterations), result="move along y-axis") randomPos = [0, 2 * (random.random() - 0.5), 0] self.movePos = vizact.move(randomPos[0], randomPos[1], randomPos[2], time=animateOutline) yield viztask.waitTime(1) yield viztask.addAction(self.outlineCenter, self.movePos) elif self.iterations > 1 and self.iterations <= 2: # Z AXIS POS TRANS config.positionVector = [0, 0, 0.0001] recordData.event(event="ROUND " + str(self.iterations), result="move along z-axis") randomPos = [0, 0, 4 * (random.random() - 0.5)] self.movePos = vizact.move(randomPos[0], randomPos[1], randomPos[2], time=animateOutline) yield viztask.waitTime(1) yield viztask.addAction(self.outlineCenter, self.movePos) elif self.iterations > 2 and self.iterations <= 3: # ALL AXES POS TRANS config.positionVector = self.origPosVec recordData.event(event="ROUND " + str(self.iterations), result="move along all axis") randomPos = [0, 1, -1] self.movePos = vizact.moveTo(randomPos, time=animateOutline) yield viztask.waitTime(1) yield viztask.addAction(self.outlineCenter, self.movePos) # # elif self.iterations>3 and self.iterations<=4: # #X AXIS ANG TRANS # config.orientationVector = [.01,0,0] # model.pointer.setEuler(0,0,0) # recordData.event(event = 'ROUND ' + str(self.iterations), result = 'euler about x-axis') # thisEuler = [0,0,0] # thisEuler[1] = random.randint(-100,100) # self.moveAng = vizact.spinTo(euler = thisEuler, time = animateOutline, mode = viz.REL_GLOBAL) # yield viztask.waitTime(1) # yield viztask.addAction(self.outlineCenter, self.moveAng) # # elif self.iterations>4 and self.iterations<=5: # #Y AXIS ANG TRANS # config.orientationVector = [0,.01,0] # model.pointer.setEuler(0,0,0) # recordData.event(event = 'ROUND ' + str(self.iterations), result = 'euler about y-axis') # thisEuler = [0,0,0] # thisEuler[0] = random.randint(-100,100) # self.moveAng = vizact.spinTo(euler = thisEuler, time = animateOutline, mode = viz.REL_GLOBAL) # yield viztask.waitTime(1) # yield viztask.addAction(self.outlineCenter, self.moveAng) # # elif self.iterations>5 and self.iterations<=6: # #Z AXIS ANG TRANS # config.orientationVector = [0,0,.01] # model.pointer.setEuler(0,0,0) # recordData.event(event = 'ROUND ' + str(self.iterations), result = 'euler about z-axis') # thisEuler = [0,0,0] # thisEuler[2] = random.randint(-100,100) # self.moveAng = vizact.spinTo(euler = thisEuler, time = animateOutline, mode = viz.REL_GLOBAL) # yield viztask.waitTime(1) # yield viztask.addAction(self.outlineCenter, self.moveAng) # # elif self.iterations>6 and self.iterations<=7: # #ALL AXES ANG TRANS # config.orientationVector = self.origOrienVec # model.pointer.setEuler(0,0,0) # recordData.event(event = 'ROUND ' + str(self.iterations), result = 'euler about all axis') # randomEuler = [random.randint(-100,100),random.randint(-100,100),random.randint(-100,100)] # self.moveAng = vizact.spinTo(euler = randomEuler, time = animateOutline) # yield viztask.waitTime(1) # yield viztask.addAction(self.outlineCenter, self.moveAng) elif self.iterations > 3 and self.iterations <= 9: # ALL AXES POS AND ANG TRANS recordData.event(event="ROUND " + str(self.iterations), result="move along all axis") randomPos = [4 * (random.random() - 0.5), 2 * (random.random() - 0.5), 4 * (random.random() - 0.5)] # randomEuler = [random.randint(-90,90),random.randint(-90,90),random.randint(-90,90)] self.movePos = vizact.moveTo(randomPos, time=animateOutline) # self.moveAng = vizact.spinTo(euler = randomEuler, time = animateOutline) transition = vizact.parallel(self.movePos) yield viztask.waitTime(1) yield viztask.addAction(self.outlineCenter, transition) else: # END menu.ingame.toggle() config.orientationVector = self.origOrienVec config.positionVector = self.origPosVec recordData.event(event="FINISHED", result="FINISHED") self.iterations = self.iterations + 1
def talk() : while True: yield viztask.waitKeyDown('1') yield viztask.addAction(avatar, vizact.animation(65)) yield viztask.addAction(cat, vizact.animation(3))
def mechanics(self): """tutorial mechanics: moves the dog outline around the environment and waits for the dog to be snapped to it before preforming the next action.""" if self.iterations == 0: #setting conditions for position transformations along single axis # model.pointer.setParent(viz.WORLD) config.orientationVector = [0, 0, 0] proxList.append(self.dogCenter) # elif self.iterations ==3: # #setting conditions for position transformations along all axes # proxList.remove(self.dogCenter) # elif self.iterations==4: # #setting conditinos for angular transformations # proxList.append(self.dogCenter) # config.orientationVector = self.origOrienVec # config.positionVector = [0,0,0] ## model.pointer.setPosition(0,1,-1) ## model.pointer.color(0,0,5) elif self.iterations == 3: #setting conditions for positional and angular transformations # model.pointer.color(self.startColor) # model.pointer.setParent(model.display.camcenter) proxList.remove(self.dogCenter) config.orientationVector = self.origOrienVec config.positionVector = self.origPosVec if self.iterations <= 0: # X AXIS POS TRANSFORMATION config.positionVector = [.0001, 0, 0] recordData.event(event='ROUND ' + str(self.iterations), result='move along x-axis') randomPos = [4 * (random.random() - 0.5), 0, 0] self.movePos = vizact.move(randomPos[0], randomPos[1], randomPos[2], time=animateOutline) yield viztask.waitTime(1) yield viztask.addAction(self.outlineCenter, self.movePos) elif self.iterations > 0 and self.iterations <= 1: #Y AXIS POS TRANS config.positionVector = [0, .0001, 0] recordData.event(event='ROUND ' + str(self.iterations), result='move along y-axis') randomPos = [0, 2 * (random.random() - 0.5), 0] self.movePos = vizact.move(randomPos[0], randomPos[1], randomPos[2], time=animateOutline) yield viztask.waitTime(1) yield viztask.addAction(self.outlineCenter, self.movePos) elif self.iterations > 1 and self.iterations <= 2: #Z AXIS POS TRANS config.positionVector = [0, 0, .0001] recordData.event(event='ROUND ' + str(self.iterations), result='move along z-axis') randomPos = [0, 0, 4 * (random.random() - 0.5)] self.movePos = vizact.move(randomPos[0], randomPos[1], randomPos[2], time=animateOutline) yield viztask.waitTime(1) yield viztask.addAction(self.outlineCenter, self.movePos) elif self.iterations > 2 and self.iterations <= 3: #ALL AXES POS TRANS config.positionVector = self.origPosVec recordData.event(event='ROUND ' + str(self.iterations), result='move along all axis') randomPos = [0, 1, -1] self.movePos = vizact.moveTo(randomPos, time=animateOutline) yield viztask.waitTime(1) yield viztask.addAction(self.outlineCenter, self.movePos) # # elif self.iterations>3 and self.iterations<=4: # #X AXIS ANG TRANS # config.orientationVector = [.01,0,0] # model.pointer.setEuler(0,0,0) # recordData.event(event = 'ROUND ' + str(self.iterations), result = 'euler about x-axis') # thisEuler = [0,0,0] # thisEuler[1] = random.randint(-100,100) # self.moveAng = vizact.spinTo(euler = thisEuler, time = animateOutline, mode = viz.REL_GLOBAL) # yield viztask.waitTime(1) # yield viztask.addAction(self.outlineCenter, self.moveAng) # # elif self.iterations>4 and self.iterations<=5: # #Y AXIS ANG TRANS # config.orientationVector = [0,.01,0] # model.pointer.setEuler(0,0,0) # recordData.event(event = 'ROUND ' + str(self.iterations), result = 'euler about y-axis') # thisEuler = [0,0,0] # thisEuler[0] = random.randint(-100,100) # self.moveAng = vizact.spinTo(euler = thisEuler, time = animateOutline, mode = viz.REL_GLOBAL) # yield viztask.waitTime(1) # yield viztask.addAction(self.outlineCenter, self.moveAng) # # elif self.iterations>5 and self.iterations<=6: # #Z AXIS ANG TRANS # config.orientationVector = [0,0,.01] # model.pointer.setEuler(0,0,0) # recordData.event(event = 'ROUND ' + str(self.iterations), result = 'euler about z-axis') # thisEuler = [0,0,0] # thisEuler[2] = random.randint(-100,100) # self.moveAng = vizact.spinTo(euler = thisEuler, time = animateOutline, mode = viz.REL_GLOBAL) # yield viztask.waitTime(1) # yield viztask.addAction(self.outlineCenter, self.moveAng) # # elif self.iterations>6 and self.iterations<=7: # #ALL AXES ANG TRANS # config.orientationVector = self.origOrienVec # model.pointer.setEuler(0,0,0) # recordData.event(event = 'ROUND ' + str(self.iterations), result = 'euler about all axis') # randomEuler = [random.randint(-100,100),random.randint(-100,100),random.randint(-100,100)] # self.moveAng = vizact.spinTo(euler = randomEuler, time = animateOutline) # yield viztask.waitTime(1) # yield viztask.addAction(self.outlineCenter, self.moveAng) elif self.iterations > 3 and self.iterations <= 9: #ALL AXES POS AND ANG TRANS recordData.event(event='ROUND ' + str(self.iterations), result='move along all axis') randomPos = [ 4 * (random.random() - 0.5), 2 * (random.random() - 0.5), 4 * (random.random() - 0.5) ] # randomEuler = [random.randint(-90,90),random.randint(-90,90),random.randint(-90,90)] self.movePos = vizact.moveTo(randomPos, time=animateOutline) # self.moveAng = vizact.spinTo(euler = randomEuler, time = animateOutline) transition = vizact.parallel(self.movePos) yield viztask.waitTime(1) yield viztask.addAction(self.outlineCenter, transition) else: #END menu.ingame.toggle() config.orientationVector = self.origOrienVec config.positionVector = self.origPosVec recordData.event(event='FINISHED', result='FINISHED') self.iterations = self.iterations + 1
def spawnMan(): loc = randExclude(-7, 7, -5, 5, 3) yield viztask.addAction(spawnedMan, vizact.walkTo(woman.getPosition(), walkSpeed=10)) print loc spawnedMan.setPosition(loc) spawnedMan.lookAt(woman.getPosition())