Esempio n. 1
0
def moveFloor():
    #Add global variable to get location of floors, play sound from them (not the stand)
    global floorSound, floors
    c = room.getFloors()
    if(floors):
        closeTime = 7 #seconds
        speed = 0.5
        floorSound.play()
        print 'OPENING THE FLOORS!'
        #Puts normal room texture on window
        #roomGroup.window.texture(FLOOR_LOGO_TEX)
        moveLeft = vizact.move([-speed,0,0], closeTime)
        moveRight = vizact.move([speed,0,0], closeTime)
        moveForward = vizact.move([0,0,speed], closeTime)
        moveBack = vizact.move([0,0,-speed], closeTime)
        floors = False
        
        c[0].addAction(moveLeft)
        c[1].addAction(moveBack)
        c[2].addAction(moveRight)
        c[3].addAction(moveForward)
    else:
        print 'CLOSING THE FLOORS!'
        floorSound.play()
        reset = vizact.moveTo(pitlabroom.TRANSLATION, speed = 0.5)
        floors = True
        for cp in c:
            cp.addAction(reset)
Esempio n. 2
0
def raiseWalls():
	for i, height in enumerate(wallHeights):
		leftWalls[i].runAction(vizact.move(0,2,0,time=(height/2)))
		rightWalls[i].runAction(vizact.move(0,2,0,time=(height/2)))
		if i == len(wallHeights) - 1:
			walls.audio_running.play()
			walls.runAction(vizact.move(0,2,0,time=(height/2)))
			walls.addAction(vizact.call(walls.audio_stop.play))
			walls.addAction(vizact.call(walls.audio_running.pause))
Esempio n. 3
0
def MovePlayer():
    import vizact
    if (hmdconnected):
        global navigationNode
        global viewLink
        navigationNode.addAction(
            vizact.move(-4, 0, 0, 60)
        )  # Move player on the X axis for 60 seconds, at the same speed as the train -- Rather than updating the position relitive to the train every frame, which resulted in jittery movement.
        viewLink = viz.link(navigationNode, viz.MainView)
        viewLink.preMultLinkable(hmd.getSensor())
    else:
        viz.MainView.addAction(vizact.move(-4, 0, 0, 60))
Esempio n. 4
0
def lowerBox():
	starting_box.audio_start.stop()
	starting_box.audio_start.play()
	starting_box.audio_running.play()
	starting_box.runAction(vizact.move(0,-2,0,time=(starting_box_height/2)))
	starting_box.addAction(vizact.call(starting_box.audio_stop.play))
	starting_box.addAction(vizact.call(starting_box.audio_running.pause))	
Esempio n. 5
0
    def updatePos(self):
        rad_to_deg = math.pi / 180.0
        msg = viz.addText("",
                          parent=viz.SCREEN,
                          pos=(0.05, 0.9, 0),
                          scale=(0.25, 0.25, 0))
        msg.setBackdrop(viz.BACKDROP_OUTLINE)
        self.readTime = 0
        t0 = viz.tick()
        while True:
            if self.going:
                #self.T1.ReadBothBeltsPosition()
                #self.T1.ReadBothBeltsSpeed()
                self.lbp = self.T1.plabTreadmill.leftBeltPosition.value
                self.rbp = self.T1.plabTreadmill.rightBeltPosition.value
                self.lbs = self.T1.plabTreadmill.leftBeltSpeed.value
                self.rbs = self.T1.plabTreadmill.rightBeltSpeed.value
                if self.verbose:
                    self.message = "Left: %6.6f, %6.6f\nRight: %6.6f, %6.6f\nReadTime: %6.6f ms"%(\
                     self.lbp, self.lbs, self.rbp, self.rbs, 1000.0*self.readTime)
                else:
                    self.message = ""
                msg.message(self.message)

                dt = viz.tick() - t0
                dtheta_dt = (self.lbs - self.rbs) / self.separation
                dr_dt = 0.5 * (self.lbs + self.rbs)
                spinner = vizact.spin(0, 1, 0, dtheta_dt, dt)
                mover = vizact.move(0, 0, dr_dt, dt)
                spinmove = vizact.parallel(spinner, mover)
                #print "gh1",dr_dt, dt
                self.track.addAction(spinmove)
                yield viztask.waitActionEnd(self.track, spinmove)
                t0 = viz.tick()

                #for the recording
                if self.recording:
                    #time, left pos, left speed, right pos, right speed, head pos (xyz, dir)
                    pp = self.track.getPosition()
                    self.history.append(
                        (viz.tick(), self.lbp, self.lbs, self.rbp, self.rbs,
                         pp[0], pp[1], pp[2], self.track.getEuler()[0]))
            #yield viztask.waitTime(1.0/19.0)
            yield viztask.waitEvent(TREADMILL_STATE_UPDATED)
Esempio n. 6
0
def CarUpdate():
    global rotateX
    global currentcar
    global speed
    global rotateY
    global deaccel

    if speed > 0:
        speed -= deaccel
    if speed < 0:
        speed += deaccel

    if speed < 0.1:
        motion = 0
    else:
        motion = 1
    move = vizact.move([0, 0, speed / 1.5], 0.1)
    rotate = vizact.spin(0, 1, 0, steer * (speed / 1.5) * 0.05, 0.1)
    viewmoveX = vizact.spinTo(quat=[rotateX, rotateY, 0, 2], time=0.1)
    offsetNode.clearActions()
    offsetNode.clearActionList()
    offsetNode.add(move, 0)
    offsetNode.add(rotate, 1)
    environment.setPosition(offsetNode.getPosition())
    speeddisplay.message('Speed: ' + str(speed))
    steerdisplay.message('Steer: ' + str(steer))
    if auto:
        geardisplay.message('Gear: Automatic')
    else:
        if gear < 0:
            geardisplay.message('Gear: Reverse')
        if gear == 0:
            geardisplay.message('Gear: Neutral')
        else:
            geardisplay.message('Gear: ' + str(gear))
    cardisplay.message(str(currentcar))
    rt["T{0}".format(x)].color(0, 0, 0)

lt = {}
for x in range(1, int((walkdistance * 50) / (targetSL * 2)), 1):
    #	rt["T{0}".format(x)]=vizshape.addQuad((0.1,targettol),axis=-vizshape.AXIS_Y,cullFace=False,cornerRadius=0)
    lt["T{0}".format(x)] = vizshape.addBox(size=[0.25, 0.02, 2 * targettol])
    lt["T{0}".format(x)].setPosition(-0.2, 0.011, targetSL + x * 2 * targetSL)
    lt["T{0}".format(x)].color(0, 0, 0)

#load avatar Mark
#global man
#man = viz.add('mark.cfg')
#rfoot = man.getBone('Bip01 R Foot')
#rfoot.lock()
#rfoot.setEuler(90,0,0)

time.sleep(1)

#generate forward velocity
scroll = vizact.move(0, 0, -1 * beltspeed, walktime)

#start the movement
walkway.add(scroll)
grass1.add(scroll)
grass2.add(scroll)
grass3.add(scroll)
divider.add(scroll)
for x in range(1, int((walkdistance * 50) / (targetSL * 2)), 1):
    rt["T{0}".format(x)].add(scroll)
    lt["T{0}".format(x)].add(scroll)
Esempio n. 8
0
    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
Esempio n. 9
0
				
	def checkHit(self,stick,pos,speed):
		#Check if drum is hit and playsound if it is
		if (self.__pos - pos).length() < self.__radius:
			#Make sure speed is enough for hit sound and that we just entered drum region
			if not self.__inRegion[stick] and speed > self.__minSpeed and pos[1] > self.__pos[1]:
				#Save hit speed
				self.hitSpeed = speed
				self.hit()
				
			self.__inRegion[stick] = True
		else:
			self.__inRegion[stick] = False

#Create action for drum hitting
DrumHitAction = vizact.sequence(vizact.move(0,-1,0,0.05),vizact.move(0,1,0,0.05))

#Create class for animation cymbal hit
CymbalHitAnimation = CymbalHit(CymbalModel)

#Create action to open hihat
OpenHiHat = vizact.goto(0,0,0,0.5)

#Create action to close hihat
CloseHiHat = vizact.goto(0,0.04,0,0.5)

#List of drums
DrumList = []

#Create tom drum
TomDrum = Drum('sounds/tom.wav',DrumHitAction)
Esempio n. 10
0
	def onTimer(self,num):
		#animation for flight
		if num == 1:
			self.count2 = self.count2+1
			print(self.count2)
			if self.count2 == 1:
				
				viz.MainView.runAction(vizact.move([0,1,0],2))
			elif self.count2 == 2:
				
				viz.MainView.runAction(vizact.move([0,0,-1],3))
			elif self.count2 == 5:
				x=0
				viz.MainView.runAction(vizact.spinTo(point=[0,30,0],time=2))
			elif self.count2 == 9:
				#end of flight or state 2
				self.avatar.stopAction(2)
				self.avatar.state(0)
				viz.MainView.setPosition([0,10,20])
				viz.lookAt([0,10,0])
				self.object2 = viz.addTexQuad(size=10)
				self.object = viz.addTexQuad(size=2)
				self.object2.setPosition([0,10,17])
				video = viz.addVideo('fly2.avi')
				video.setRate(1)
				video.volume(0) 

				video.play()
				self.object.texture(video)
				self.object.setAxisAngle( [0, 1, 0 , 180] ) 
				self.object.setPosition([0,10,18])
				#destroy stage for illusion flightand start next state
				self.model.remove()
				self.avatar.state(3)

				#start next part and reset cound
				self.count2 = 0
				self.starttimer(3,1,28)
		elif num == 2:
			#start of animation
			self.count = self.count +1
			print(self.count)
			if self.count == 17:
				self.textScreen.remove()
				self.object.remove()
				self.avatar.state(1)
			elif self.count == 20:
				self.avatar.stopAnimation(1)
			elif self.count == 22:
				#start flight
				self.starttimer(1,1,8)
				self.avatar.execute(2)
		elif num == 3:
			self.count2 = self.count2 + 1
				

			if self.count2 == 9:
				#adding last stage
				viz.MainView.runAction(vizact.move([0,0,-1],7))
				self.object3 = viz.addTexQuad(size=55)
				video = viz.addVideo('skyanim.avi')
				video.setRate(1)
				video.volume(0) 
				video.play()
				video.loop()
				#fixing video position
				self.object3.texture(video)
				self.object3.setAxisAngle( [0, 1, 0 , 180] ) 
				self.object3.setPosition([0,10,-10])
				self.object4 = viz.addTexQuad(size=50)
				
				self.object4.setPosition([0,10,-11])
				self.object.remove()
				self.object2.remove()
for x in range(1,50,1):
	r7t["T{0}".format(x)]=vizshape.addBox(size=[0.1,0.1,0.1])
	r7t["T{0}".format(x)].setPosition(0,1.5,2*x)
	t7locs["T{0}".format(x)]=2*x
	r7t["T{0}".format(x)].color(1,1,1)
	
r8t = {}
t8locs = {}
for x in range(1,50,1):
	r8t["T{0}".format(x)]=vizshape.addBox(size=[0.1,0.1,0.1])
	r8t["T{0}".format(x)].setPosition(2*0.462,1.5,2*x)
	t8locs["T{0}".format(x)]=2*x
	r8t["T{0}".format(x)].color(1,1,1)
	
#generate forward velocity
scroll = vizact.move(0,0,-1*beltspeed,50)
for x in range(1,50,1):
	rt["T{0}".format(x)].add(scroll)
	r2t["T{0}".format(x)].add(scroll)
	r3t["T{0}".format(x)].add(scroll)
	r4t["T{0}".format(x)].add(scroll)
	r5t["T{0}".format(x)].add(scroll)
	r6t["T{0}".format(x)].add(scroll)
	r7t["T{0}".format(x)].add(scroll)
	r8t["T{0}".format(x)].add(scroll)
	
global HideSphere #for trying to block the view when IK freaks out or too many markers are occluded
HideSphere = viz.addChild('hidesphere2.osgb',scale=[0.1,0.1,0.1])
HideSphere.setPosition(0,0,0)
HideSphere.color(0,0,0)
HideSphere.visible(0)
Esempio n. 12
0
    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
for x in range(1, 50, 1):
    r7t["T{0}".format(x)] = vizshape.addBox(size=[0.1, 0.1, 0.1])
    r7t["T{0}".format(x)].setPosition(0, 1.5, 2 * x)
    t7locs["T{0}".format(x)] = 2 * x
    r7t["T{0}".format(x)].color(1, 1, 1)

r8t = {}
t8locs = {}
for x in range(1, 50, 1):
    r8t["T{0}".format(x)] = vizshape.addBox(size=[0.1, 0.1, 0.1])
    r8t["T{0}".format(x)].setPosition(2 * 0.462, 1.5, 2 * x)
    t8locs["T{0}".format(x)] = 2 * x
    r8t["T{0}".format(x)].color(1, 1, 1)

#generate forward velocity
scroll = vizact.move(0, 0, -1 * beltspeed, 50)
for x in range(1, 50, 1):
    rt["T{0}".format(x)].add(scroll)
    r2t["T{0}".format(x)].add(scroll)
    r3t["T{0}".format(x)].add(scroll)
    r4t["T{0}".format(x)].add(scroll)
    r5t["T{0}".format(x)].add(scroll)
    r6t["T{0}".format(x)].add(scroll)
    r7t["T{0}".format(x)].add(scroll)
    r8t["T{0}".format(x)].add(scroll)

global HideSphere  #for trying to block the view when IK freaks out or too many markers are occluded
HideSphere = viz.addChild('hidesphere2.osgb', scale=[0.1, 0.1, 0.1])
HideSphere.setPosition(0, 0, 0)
HideSphere.color(0, 0, 0)
HideSphere.visible(0)
#link hallways together so only have to manipulate 1 to get the rest
oblink1 = viz.link(OF1,OF2)
oblink1.postTrans([0,0,1.27*3])
oblink2 = viz.link(OF1,OF3)
oblink2.postTrans([0,0,1.27*6])

navigationNode.setPosition((0,0.15,-1.27*3/2+0.002))
#viz.MainView.setPosition(0,0.15,-1.27*3/2+0.002) 
#viz.MainView.setEuler(0,0,0)

global endflag
endflag = threading.Event()

global scroll
scroll = vizact.move(0,0,-1,5000)

def thread1():
	global endflag
	global navigationNode
	global scroll
	view = viz.MainView
	hmd.getSensor().reset()
	while not endflag.is_set():
#		out = view.getPosition(mode=viz.ABS_GLOBAL)
		out = OF1.getPosition(mode=viz.ABS_GLOBAL)
#		if (out[2] > 1.27*3/2):
		if (out[2] < -1.27*3):
#			view.velocity(0,0,0)
#			view.setPosition(0,0.15,-1.27*3/2+0.002)
#			navigationNode.setPosition((0,0.15,-1.27*3/2+0.002))
Esempio n. 15
0
#light.spread(180)
#light.intensity(2000)

#hlight = viz.MainView.getHeadLight()
#hlight.intensity(200000)
#hlight.disable()

navigationNode.setPosition((0, 0, 0.002))
#viz.MainView.setPosition(0,0.15,-1.27*3/2+0.002)
#viz.MainView.setEuler(0,0,0)

global endflag
endflag = threading.Event()

global scroll
scroll = vizact.move(0, 0, -1, 5000)


def thread1():
    global endflag
    global navigationNode
    global scroll
    view = viz.MainView
    hmd.getSensor().reset()
    while not endflag.is_set():
        #		out = view.getPosition(mode=viz.ABS_GLOBAL)
        out = OF1.getPosition(mode=viz.ABS_GLOBAL)
        #		if (out[2] > 1.27*3/2):
        if (out[2] < -1.27 * 3):
            #			view.velocity(0,0,0)
            #			view.setPosition(0,0.15,-1.27*3/2+0.002)
Esempio n. 16
0
trainMove.volume(1.0)

trainCrowdLow = viz.addAudio('Assets/Audio/Crowds.wav')
trainCrowdLow.loop(viz.ON)
trainCrowdLow.volume(0.1)

trainCrowdMed = viz.addAudio('Assets/Audio/Crowds.wav')
trainCrowdMed.loop(viz.ON)
trainCrowdMed.volume(0.5)

trainCrowdHigh = viz.addAudio('Assets/Audio/Crowds.wav')
trainCrowdHigh.loop(viz.ON)
trainCrowdHigh.volume(1.0)

# Train Move forward for 60 seconds function
moveForward = vizact.move(0, 0, 4, 60)

# Global Variables
playerOnTrain = False
stage = -1
averageHR = 0
age = 0
recordedHR = []
spacePressed = False
restingHR = 0
overwriteHR = 0

viz.mouse.setOverride()  # Disable mouse movement and rotation control

# Black screen overlay allowed Fade in and Fade out
blackScreen = viz.addTexQuad(size=100, pos=[0, 0, 1], color=viz.BLACK)
Esempio n. 17
0
performer.setPosition([0, .2, -11])
performer.blend(4,0.5)
performer.blend(5,0.5)

head = performer.getBone('Bip01 Head')
HatLink = viz.link(head,hat)
#Tweek the hat link so it fits snuggly on the head
HatLink.preTrans( [0,0.15,-0.0] )
HatLink.preEuler( [0,-10,0] )

	
for x in [-1,0,1]:
	backupDancer = viz.addAvatar('vcc_female.cfg')
	backupDancer.setPosition([x, .2, -13])
	backupDancer.state(5)
	jump = vizact.move(0,0,1,1)
	turn = vizact.spin(0,1,0,180,1)
	danceMove = vizact.sequence(jump,turn,-1)
	backupDancer.addAction(danceMove)



armBone = performer.getBone('Bip01 R Hand') 
#armBone.lock()
#armBone.setEuler(0, 45, 0)
#viz.link(armBone,mic)



for x in [-3, -1, 1, 3]:
	for z in [4, 2, 0, -2, -4]:
Esempio n. 18
0
def maleWalk():
	oldPos = male.getPosition()
	walk = vizact.move(4, 0, 0, 1)
	male.state(1)
	male.runAction(walk)
	vizact.ontimer2(1, 0, femaleWalk, oldPos)
Esempio n. 19
0
 def update(self, elapsed, object):
     pos = tracker.getPosition()
     comeToUser = vizact.moveTo(pos, begin=None, speed=1, time=1, mode=viz.ABS_PARENT, interpolate=None)
     getBigger = vizact.sizeTo(1.5, 1.5, 1.5)
     moveForward = vizact.move(1, 0, 0, elapsed)
     pigeon.addAction(moveForward)
Esempio n. 20
0
MOVE_SPEED = .005
ROTATION_SPEED = 5
SUB_GROUP_SPACING = 20
for i in range(0, NUM_DOTS):
	x = random.random() - 0.5
	y = random.random() / 2
	z = random.random() - 0.5
	length = math.sqrt(x*x + y*y + z*z)
	x = x / length * RADIUS
	y = y / length * RADIUS
	z = z / length * RADIUS
	particleGroup = viz.addGroup()
	particleGroup.setPosition([x, y, z])
	particleGroup.setEuler([random.random()*360, random.random()*360, random.random()*360])
	particleGroup.addAction(vizact.spin(random.random(),random.random(),random.random(), random.random()*ROTATION_SPEED,viz.FOREVER))
	particleGroup.addAction(vizact.move(random.random()*MOVE_SPEED,random.random()*MOVE_SPEED,random.random()*MOVE_SPEED,viz.FOREVER), 1)
	
	for i in range(10):
		clone = particle.clone()
		clone.parent(particleGroup)
		clone.setScale([SCALE]*3)
		clone.setEuler([random.random()*360, random.random()*360, random.random()*360])
		clone.setPosition([random.random()*SUB_GROUP_SPACING, random.random()*SUB_GROUP_SPACING, random.random()*SUB_GROUP_SPACING])
	
	

if __name__ == '__main__':
	viz.go()
	viz.add('tut_ground.wrl')
	viz.clearcolor(viz.BLUE)
Esempio n. 21
0
	def WeighPitcher (self, duration, amount, factor):
		self.base.addAction(vizact.move(0,-0.01,0, time=duration))
		angle = amount * factor / 10	#divide by 10 to get the factor (float) from the integer
		self.needle.addAction(vizact.spin(0,120,0, speed=angle/duration, dur=duration))
Esempio n. 22
0
import viz
import vizact

viz.setMultiSample(4)
viz.fov(60)
viz.go()

viz.addChild('ground.osgb')
wheel = viz.addChild('wheelbarrow.ive')
viz.MainView.move([0,0,-7])
viz.clearcolor(viz.SKYBLUE)

moveForward = vizact.move(0,0,2,1)
turnRight = vizact.spin(0,1,0,90,1)
moveInSquare = vizact.sequence(moveForward, turnRight, 4)

#wheel.addAction(moveInSquare)
vizact.onkeydown(' ', wheel.addAction, moveInSquare)
vizact.onkeydown('c', wheel.clearActions)

rthigh.lock()
global lfoot
lfoot = man.getBone('Bip01 L Foot')
lfoot.lock()
global lcalf
lcalf = man.getBone('Bip01 L Calf')
lcalf.lock()
global lthigh
lthigh = man.getBone('Bip01 L Thigh')
lthigh.lock()


time.sleep(1)

#generate forward velocity
scroll = vizact.move(0,0,-1*beltspeed,walktime)

#start the movement
walkway.add(scroll)
grass1.add(scroll)
grass2.add(scroll)
grass3.add(scroll)
divider.add(scroll)
for x in range(1,int((walkdistance*50)/(targetSL*2)),1):
	rt["T{0}".format(x)].add(scroll)
	lt["T{0}".format(x)].add(scroll)
	
def UpdateViz(root,q):#,speedlist,qq,savestring,q3):

	while not endflag.isSet():