def actionsCreation(molecule):
	init_pos = molecule.getPosition()
	leftDown = vizact.moveTo([init_pos[0] + .05, init_pos[1] + .1, 0], speed = .05)
	rightDown = vizact.moveTo([init_pos[0] - .1, init_pos[1] - .05, 0], speed = .05)
	leftUp = vizact.moveTo([init_pos[0] + .1, init_pos[1] + .05, 0], speed = .05)
	rightUp = vizact.moveTo([init_pos[0] - .05, init_pos[1] + .1, 0], speed = .05)
	moleculeSequence = [leftDown, rightDown, leftUp, rightUp]
	return randomSortActions(moleculeSequence)
def actionsCreation(molecule):
    pos_x, pos_y, pos_z = molecule.getPosition()
    leftDown = vizact.moveTo([pos_x + 0.05, pos_y + 0.1, pos_z], speed=0.05)
    rightDown = vizact.moveTo([pos_x - 0.1, pos_y - 0.05, pos_z - 0.05], speed=0.05)
    leftUp = vizact.moveTo([pos_x + 0.1, pos_y + 0.05, pos_z], speed=0.05)
    rightUp = vizact.moveTo([pos_x - 0.05, pos_y + 0.1, pos_z + 0.05], speed=0.05)
    moleculeSequence = [leftDown, rightDown, leftUp, rightUp]
    return randomSortActions(moleculeSequence)
示例#3
0
	def FillMat (self):
		self.paste1.setPosition(0,0,0)
		self.paste2.setPosition(0,-.02,0)
		self.paste1.addAction(vizact.method.visible(1))
		self.paste1.addAction(vizact.fadeTo(1, time=.5))
		self.paste1.addAction(vizact.moveTo([0,-.1,0], time=2))
		self.paste2.addAction(vizact.waittime(1))
		self.paste2.addAction(vizact.method.visible(1))
		self.paste2.addAction(vizact.moveTo([0,0,0], time=2))
示例#4
0
	def dynamicCalibrationMethod(self):
		
		if ( self.calibrationInProgress == False ):
			self.calibrationInProgress = True
			self.toggleRoomWallsVisibility()
			self.calibrationCounter = 27
			self.calibrationSphereRadius = self.initialValue
			self.calibrationSphere = vizshape.addSphere(self.calibrationSphereRadius, color = viz.PURPLE)
			self.calibrationSphere.emissive(viz.PURPLE)
			self.calibrationSphere.setParent(self.parentNode)
			newPos = [-3,-.5,12]
			self.setSphereRadius(self.parentNode.getPosition(viz.ABS_GLOBAL), newPos, 0)
			self.calibrationSphere.setPosition(newPos[0], newPos[1], newPos[2],viz.ABS_PARENT)
			self.targetMovingAction = vizact.onupdate(viz.PRIORITY_INPUT+1, self.checkActionDone)

			self.text_object = viz.addText('')
			self.text_object.setParent(self.calibrationSphere)
			self.text_object.renderOnlyToWindows([self.renderToWindows])
			self.localAction = vizact.onupdate(viz.PRIORITY_INPUT+1,self.calculateAngularError, self.cyclopEyeSphere.node3D, 0.0, self.text_object)#self.currentTrial.ballObj.node3D

			print 'Dynamic Calibration Procedure Started'
			#Use a moveTo action to move a node to the point [0,0,25] at 2 meters per second  
			self.moveAction = vizact.moveTo([-3,-0.5,12],speed=2)
			self.calibrationSphere.addAction(self.moveAction)
			self.moveAction = vizact.moveTo([3,-0.5,12],speed=2)
			self.calibrationSphere.addAction(self.moveAction)
			self.moveAction = vizact.moveTo([3,3,12],speed=2)
			self.calibrationSphere.addAction(self.moveAction)
			self.moveAction = vizact.moveTo([-3,3,12],speed=2)
			self.calibrationSphere.addAction(self.moveAction)
			self.moveAction = vizact.moveTo([-3,-0.5,12],speed=2)
			self.calibrationSphere.addAction(self.moveAction)

			self.moveAction = vizact.moveTo([-3,-0.5,6],speed=2)
			self.calibrationSphere.addAction(self.moveAction)
			self.moveAction = vizact.moveTo([3,-0.5,6],speed=2)
			self.calibrationSphere.addAction(self.moveAction)
			self.moveAction = vizact.moveTo([3,3,6],speed=2)
			self.calibrationSphere.addAction(self.moveAction)
			self.moveAction = vizact.moveTo([-3,3,6],speed=2)
			self.calibrationSphere.addAction(self.moveAction)
			self.moveAction = vizact.moveTo([-3,0,6],speed=2)
			self.calibrationSphere.addAction(self.moveAction)



		else:
			self.localAction.remove()
			self.text_object.remove()
			self.calibrationInProgress = False
			self.calibrationCounter = 0
			self.calibrationSphere.remove()
			self.toggleRoomWallsVisibility()
			print 'Quit Dynamic Calibration!!'
示例#5
0
	def MovePitcher (self, t):
		pitcher = self.components['pitcher'+self.LR]
		posX = self.object.getPosition()[0]
		off = 0		#this is the offset for the left DeLaval's pitcher
		if self.LR == 'R':
			off = .5
		pitcher.addAction(vizact.moveTo([posX,0,-4], time=2*t/10, interpolate=vizact.easeInOut, mode=viz.ABS_GLOBAL))
		pitcher.addAction(vizact.moveTo([-2.5,0,-5], time=5*t/10, interpolate=vizact.easeInOut, mode=viz.ABS_GLOBAL))
		pitcher.addAction(vizact.moveTo([-2.5-off,0,-6.8+off], time=3*t/10, interpolate=vizact.easeInOut, mode=viz.ABS_GLOBAL))
		pitcher.addAction(vizact.moveTo([-2.5-off,-0.08,-6.8+off], time=.2, mode=viz.ABS_GLOBAL))
		pitcher.addAction(vizact.moveTo([-2.5-off,-0.1, -6.8+off], time=2, interpolate=vizact.easeInOutCircular, mode=viz.ABS_GLOBAL))
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
示例#7
0
	def __init__(self, x, y, z, zf, shoulder_width,TTC):
		# Width requires float variable, else round up...
		self.s_width = float(shoulder_width)/2
		self.TTC = float(TTC)
		self.position1 = [x, y, z]
		self.position2 = [-x, y, z]
		self.finalpos1 = [self.s_width, y, zf]
		self.finalpos2 = [-self.s_width, y, zf]
		self.act1 = vizact.moveTo(self.finalpos1,self.position1, time = self.TTC)
		self.act2 = vizact.moveTo(self.finalpos2,self.position2, time = self.TTC)
		self.disappear = vizact.fadeTo(0,time = 0)
		self.pause = vizact.waittime(1)
		self.FagenSequence = vizact.sequence(self.pause,self.disappear)
示例#8
0
def d(a):
    if a == 1:
        move = vizact.moveTo([-0.4, 6, 6], speed=12)
        head_tracker.addAction(move)
        head_tracker.runAction(move)
        #		viz.window.displayHTML('F:\Lab 2\index.html',size=[1200,600],pos=[30,30,-30])
        #		head_tracker.setEuler([0,0,0])
        viztask.schedule(MyTask())
    if a == 2:

        viz.window.hideHTML()
        move = vizact.moveTo([0, 1.5, 0], speed=15)
        head_tracker.addAction(move)
        head_tracker.runAction(move)
        head_tracker.setEuler([0, 0, 0])
def d(a):
	if a==1:
		move=vizact.moveTo([-0.4,6,6],speed=12)
		head_tracker.addAction(move)
		head_tracker.runAction(move)
#		viz.window.displayHTML('F:\Lab 2\index.html',size=[1200,600],pos=[30,30,-30])
#		head_tracker.setEuler([0,0,0])
		viztask.schedule(MyTask())
	if a==2:
		
		viz.window.hideHTML()
		move=vizact.moveTo([0,1.5,0],speed=15)
		head_tracker.addAction(move)
		head_tracker.runAction(move)
		head_tracker.setEuler([0,0,0])
def moveBackToFirstSeat( node, seatQueue ):
	yield viztask.waitTime(1)
	spin = vizact.turn(145)
	moveHead = vizact.headto(25,0,0, bone='Bip01 Head')
	moveFirst = vizact.moveTo(pos=seatQueue[2],speed=0.75,interpolate=vizact.easeInOut)
	moveSecond = vizact.moveTo(pos=seatQueue[1],speed=0.75,interpolate=vizact.easeInOut)
	moveThird = vizact.moveTo(pos=seatQueue[0],speed=0.75,interpolate=vizact.easeInOut)
	slide = vizact.animation(66)
	slideBackOnce = vizact.parallel(spin,moveHead,moveFirst,slide)
	slideBackTwice = vizact.parallel(spin,moveHead,moveSecond,slide)
	slideBackThrice = vizact.parallel(spin,moveHead,moveThird,slide)
	shuffleToFirst = vizact.sequence(slideBackOnce,slideBackTwice,slideBackThrice)
	node.add(shuffleToFirst)
	yield viztask.waitActionEnd(node,shuffleToFirst)
	node.setPosition(seatQueue[0])
示例#11
0
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)
示例#13
0
def onRelease(e):
    e.released.endAction(pool=viz.ALL_POOLS)
    pos = viz.MainView.getPosition()
    action = vizact.moveTo(pos, speed=0.5)
    e.released.addAction(action)

    viz.window.setPolyMode(viz.POLY_FILL)
示例#14
0
	def PulpInTank (self, inOut):	# >0 -> add, <0 -> subtract
		self.PulpLevel += inOut
		amount = self.PulpLevel * .05
		pulp = self.components['pulp']
		move = vizact.moveTo([0,amount,0], time=3)
		resize = vizact.sizeTo([1+amount/4,1,1+amount/2], time=3)
		pulp.addAction(vizact.parallel(move, resize))
示例#15
0
	def SackAnim (self, sid):	#sid is the sack id: {1R, 2R, 1L, or 2L}
		self._usedSackCounter += 1
		sack = self.components['sack'+sid]
		self.sack_path = self.sackItem.getChild('path'+sid).copy()
		self.sack_path.setParent(self.factory)	#prevent from appearing in MainWindow
		sack.setParent(self.sack_path, node='path'+sid)
		self.sack_path.setAnimationSpeed(1)
		sack.addAction(vizact.waittime(3))	#wait for sack animation
		endAnimSignal = vizact.signal()
		trig = endAnimSignal.trigger
		hide = vizact.method.visible(0)
		sack.addAction(vizact.parallel(hide, trig))
		self.sackPour.addAction(endAnimSignal.wait)	# wait for animation before pouring starts
		self.sackPour.addAction(vizact.method.alpha(1, node='sack_bent'))
		self.sackPour.addAction(vizact.spinTo(euler=[0,-45,0], time=.75, interpolate=vizact.easeInStrong))
		self.sackPour.addAction(vizact.fadeTo(1, begin=0, time=.5, node='olive_flow'))
		loadSignal = vizact.signal()
		self.sackPour.addAction(loadSignal.trigger)
		self.sackPour.addAction(vizact.waittime(5))
		self.sackPour.addAction(vizact.fadeTo(0, time=.5))
		self.sackPour.addAction(vizact.method.setEuler([0,0,0]))	# put it back standing
		self.mixedPulp.addAction(loadSignal.wait)	# wait for olive pouring before pulp appears
		self.mixedPulp.addAction(vizact.method.visible(1))
		#self.mixedPulp.addAction(vizact.fadeTo(1, begin=0, time=1, node='olives'))
		move = vizact.moveTo([0, 0, 0], time=5)
		resize = vizact.sizeTo([1, 1, 1], time=5, interpolate=vizact.easeIn)
		self.mixedPulp.addAction(vizact.parallel(move, resize))
		self.sack_path.addAction(loadSignal.wait)
		self.sack_path.addAction(vizact.method.setAnimationSpeed(-100))	#put sack back
示例#16
0
	def CoalAction(self, act):	#act=1->load, 2->light, 3->waste
		coalFurnace = self.components['coalfurnace']
		if act == 1:	#fade in the coals
			coalFurnace.addAction(vizact.method.visible(1))
			coalFurnace.addAction(vizact.fadeTo(1, begin=0, time=1))
		elif act == 2:	#turn coals red and light fire
			self.PlayAudio('boiler_light', coalFurnace, viz.PLAY)
			fireSignal = vizact.signal()
			coalFurnace.addAction(vizact.fadeTo(viz.RED, time=1))
			coalFurnace.addAction(fireSignal.trigger)
			cPos = coalFurnace.getPosition()
			coalFurnace.addAction(vizact.moveTo([cPos[0],cPos[1],cPos[2]+.1],time=.5))
			self.fire.addAction(fireSignal.wait)
			self.fire.addAction(vizact.method.visible(1))
			self.fire.addAction(vizact.fadeTo(0.75, time=1))
			self.fire.addAction(vizact.waittime(4))
			self.fire.addAction(vizact.call(self.PlayAudio, 'boiler_furnace'))
		elif act == 3:	#fade out the coals and fire
			self.AdjustAudio(.5)
			coalFurnace.addAction(vizact.fadeTo(0.25, time=.5))
			self.fire.addAction(vizact.fadeTo(0.25, time=.5))
		elif act == 4:	#light up the coals and fire again
			self.AdjustAudio(1)
			coalFurnace.addAction(vizact.fadeTo(1, time=.5))
			self.fire.addAction(vizact.fadeTo(.75, time=.5))
		elif act == 5:	#fade out the coals and fire completely
			self.AdjustAudio(0)
			self.AdjustAudio(1)
			coalFurnace.addAction(vizact.fadeTo(0, time=.5))
			coalFurnace.addAction(vizact.method.setPosition([0,0,0]))
			coalFurnace.addAction(vizact.method.color(viz.GRAY))
			coalFurnace.addAction(vizact.method.visible(0))
			self.fire.addAction(vizact.fadeTo(0, time=.5))
			self.fire.addAction(vizact.method.visible(0))
示例#17
0
def addCarToWorld(info):
	car = vizfx.addChild(random.choice(info.CAR_FILES), pos=info.startPosition)
	actions = []
	for i in range(len(info.coordinates)):
		actions.append(vizact.spinTo(euler=info.directions[i]))
		actions.append(vizact.moveTo(info.coordinates[i], speed=info.speed))
	car.runAction(vizact.sequence(actions, viz.FOREVER))
示例#18
0
	def loadMeshes(self, meshes = [], animate = False, randomize = True):
		"""Load all of the files from the dataset into puzzle.mesh instances"""
		for i, fileName in enumerate(meshes):
			# This is the actual mesh we will see
			b = model.Mesh(fileName)
			print b.name
			if (not randomize):
				#Hardcoded keystone
				b.setPosition([0.0,1.5,0.0])
				b.setEuler([0.0,90.0,180.0]) # [0,0,180] flip upright [0,90,180] flip upright and vertical
			else:		
				# b.setPosition([(random.random()-0.5)*3, 1.0, (random.random()-0.5)*3]) # random sheet, not a donut
				angle	= random.random() * 2 * math.pi
				radius	= random.random() + 1.5
				
				targetPosition	= [math.sin(angle) * radius, 1.0, math.cos(angle) * radius]
				targetEuler		= [0.0,90.0,180.0]
				#targetEuler	= [(random.random()-0.5)*40,(random.random()-0.5)*40 + 90.0, (random.random()-0.5)*40 + 180.0]
				
				if (animate):
					move = vizact.moveTo(targetPosition, time = 2)
					spin = vizact.spinTo(euler = targetEuler, time = 2)
					transition = vizact.parallel(spin, move)
					b.addAction(transition)
				else:					
					b.setPosition(targetPosition)
					b.setEuler(targetEuler)
			
			self._meshes.append(b)
			self._meshesById[b.id] = b
示例#19
0
	def StartSeparation (self, start):
		self.oil.addAction(vizact.fadeTo(start, time=.5))
		self.water.addAction(vizact.fadeTo(start, time=.5))
		if start == 1:
			pitcher = self.components['pitcher'+self.LR]
			oilSurf = pitcher.getChild('oilSurface')
			oilSurf.addAction(vizact.moveTo([0,.5,0], time=10))
示例#20
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)
示例#21
0
 def moveView(self):
     # move view
     xT,_,zT  = self.cTrial.getPos('src', 'near')
     moveTo = vizact.moveTo([xT,ct.EYE_HEIGHT,zT], speed=5)
     viz.MainView.addAction(moveTo)
  
     yield viztask.waitActionEnd(viz.MainView, moveTo)
  
     # make source building semi transparent
     self.cTrial.showBuilding('src', 'transparent')
     
     # align reference vertex to mainview
     self.refVert.setMatrix( viz.MainView.getMatrix() )
             
     # enable user mouse look
     WalkNavigate(forward='w', backward='s', left='a', right='d', moveScale=0, turnScale=1.0)
     
     vx, _, vz = viz.MainView.getPosition()
     # draw grid            
     self.cross90.setPosition(vx, 0.01, vz)
     self.cross90.visible(viz.ON)
             
     self.grid.setPosition(vx, 0.1, vz)
     self.grid.visible(viz.ON)
     
     viztask.schedule( self.getTargetAngle() )
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
示例#23
0
def move_and_scale():
    for m_b in range(bubble_num):
        groups_bubble[m_b].visible(viz.ON)
        bubble_pos = groups_bubble[m_b].getPosition(viz.ABS_GLOBAL)
        bubble_pos[1] = bubble_pos[1] + 30.0
        action_bubble = vizact.moveTo(bubble_pos, speed=1)
        action_scale_bubble = vizact.sizeTo([10, 10, 10], time=30)
        groups_bubble[m_b].addAction(action_bubble, pool=11)
        groups_bubble[m_b].addAction(action_scale_bubble, pool=12)
示例#24
0
	def snap(self):
		"""
		Moves dog to the pos and euler of its target (dogTarget)
		"""
		movePos = vizact.moveTo(self.outlineCenter.getPosition(), time = self.snapTransitionTime)
		moveAng = vizact.spinTo(euler = self.outlineCenter.getEuler(), time = self.snapTransitionTime)
		transition = vizact.parallel(movePos, moveAng)
		self.dogCenter.addAction(transition)
		viz.playSound(".\\dataset\\snap.wav")
		viztask.schedule(self.mechanics())
示例#25
0
文件: pit.py 项目: vhilab/VRITS-2015
def TogglePlatform():
    """Toggle raising/lower of platform"""
    platform.raised = not platform.raised
    pos = platform.positions[platform.raised]
    platform.audio_start.stop()
    platform.audio_start.play()
    platform.audio_running.play()
    platform.runAction(vizact.moveTo(pos,speed=2.0))
    platform.addAction(vizact.call(platform.audio_stop.play))
    platform.addAction(vizact.call(platform.audio_running.pause))
示例#26
0
	def PasteInTank (self):
		hatch = self.components['hatch'+self.LR]
		hatch.addAction(vizact.moveTo([.3-.275, .976-.879, -0.956+.907], time=1, interpolate=vizact.easeInOut))
		hatch.addAction(vizact.waittime(1))
		openSignal = vizact.signal()
		hatch.addAction(openSignal.trigger)
		# code for pouring animation
		self.pourPulp.addAction(openSignal.wait)
		self.pourPulp.addAction(vizact.fadeTo(1, time=.5))
		self.pourPulp.addAction(vizact.waittime(5))
		self.pourPulp.addAction(vizact.fadeTo(0, time=.5))
		self.tankPulp.addAction(openSignal.wait)
		self.tankPulp.addAction(vizact.waittime(.5))
		self.tankPulp.addAction(vizact.moveTo([0,.4,0], time=5, interpolate=vizact.easeOut))
		self.mixedPulp.addAction(openSignal.wait)
#		self.mixedPulp.addAction(vizact.fadeTo(0, time=5))
		move = vizact.moveTo([0, -.28, 0], time=5, interpolate=vizact.easeOut)
		resize = vizact.sizeTo([.85,1,.85], time=5, interpolate=vizact.easeOut)
		self.mixedPulp.addAction(vizact.parallel(move, resize))
示例#27
0
def snap(dog, dogTarget):
    """
	Moves dog to the pos and euler of its target (dogTarget)
	"""
    movePos = vizact.moveTo(dogTarget.getPosition(), time=snapTransitionTime)
    moveAng = vizact.spinTo(euler=dogTarget.getEuler(), time=snapTransitionTime)
    transition = vizact.parallel(movePos, moveAng)
    dog.addAction(transition)
    viz.playSound(".\\dataset\\snap.wav")
    viztask.schedule(Tutorial.mechanics())
def TogglePit():
	"""Toggle raising/lowering of pit"""
	pit.lowered = not pit.lowered
	pos = pit.positions[pit.lowered]
	pit.runAction(vizact.moveTo(pos,speed=2.0))

	# Use pit color to blend between lower/upper lightmaps
	duration = pit.getActionInstance().getDuration()
	color = pit.colors[pit.lowered]
	pit.runAction(vizact.fadeTo(color,time=duration),pool=1)
示例#29
0
def TogglePit():
    """Toggle raising/lowering of pit"""
    pit.lowered = not pit.lowered
    pos = pit.positions[pit.lowered]
    pit.runAction(vizact.moveTo(pos, speed=2.0))

    # Use pit color to blend between lower/upper lightmaps
    duration = pit.getActionInstance().getDuration()
    color = pit.colors[pit.lowered]
    pit.runAction(vizact.fadeTo(color, time=duration), pool=1)
def moveBackwards( node, seat ):
	global seatQueue
	spin = vizact.turn(145)
	moveHead = vizact.headto(25,0,0, bone='Bip01 Head')
	move = vizact.moveTo(pos=seat,speed=0.75,interpolate=vizact.easeInOut)
	slide = vizact.animation(66)
	shuffle = vizact.parallel(spin,moveHead,move,slide)
	shuffleBack = vizact.sequence(shuffle)
	node.add(shuffleBack)
	yield viztask.waitActionEnd(node,shuffleBack)
	node.setPosition(seat)
示例#31
0
def snap(dog, dogTarget):
    """
	Moves dog to the pos and euler of its target (dogTarget)
	"""
    movePos = vizact.moveTo(dogTarget.getPosition(), time=snapTransitionTime)
    moveAng = vizact.spinTo(euler=dogTarget.getEuler(),
                            time=snapTransitionTime)
    transition = vizact.parallel(movePos, moveAng)
    dog.addAction(transition)
    viz.playSound(".\\dataset\\snap.wav")
    viztask.schedule(Tutorial.mechanics())
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
示例#33
0
	def MoveBarrow (self):
		barrow = self.components['barrow']
		#update barrow to the new position
		self.faClass.componentPos[barrow] = [-22.5,0.5,9.5]
		barrow.addAction(vizact.spinTo(euler=[0,0,10], time=.5))
		waitLift = vizact.signal()
		barrow.addAction(waitLift.trigger)
		self.wheel.addAction(waitLift.wait)
		self.wheel.addAction(vizact.spin(0,0,1,120, dur=4))
		moveB = vizact.moveTo([-22.5,0.325,9.5], time=4, mode=viz.ABS_GLOBAL, interpolate=vizact.easeOut)
		rotateB = vizact.spinTo(euler=[-90,0,10], time=5)
		barrow.addAction(vizact.parallel(moveB, rotateB))
		barrow.addAction(vizact.spinTo(euler=[-90,0,0], time=.5))
示例#34
0
	def ChangeGuide (self, dir):	#dir=1 -> move right, -1 -> move left
		dir = -dir
		handle = self.components['handle']
		pos = handle.getPosition()
		newPos = [pos[0]+.095*dir, pos[1], pos[2]]
		self.faClass.belts['oilPump'].MoveBelt(-dir, .095)
		handle.addAction(vizact.moveTo(newPos, time=2, interpolate=vizact.easeInOut))
		if dir < 0:
			handle.addAction(vizact.call(self.StopCrazy))
			handle.addAction(vizact.call(self.SetMotion))
		else:
			handle.addAction(vizact.call(self.StartCrazy))
			handle.addAction(vizact.call(self.EndMotion))
示例#35
0
	def moveTo(self, matrix, animate = True, time = 0.3):
		"""
		Invoked by the puzzle.snap method to handle local business
		"""
		# WARNING the full setMatrix cannot be assigned because scale is different!
		if (animate):
			move = vizact.moveTo(matrix.getPosition(), time = time, mode = viz.ABS_GLOBAL)
			spin = vizact.spinTo(euler = matrix.getEuler(), time = time, mode = viz.ABS_GLOBAL)
			transition = vizact.parallel(spin, move)
			self.addAction(transition)
		else:
			self.setPosition(targetPosition, viz.ABS_GLOBAL)
			self.setEuler(targetEuler,viz.ABS_GLOBAL)
示例#36
0
	def moveTo(self, BB, animate = True, time = 0.3):
		"""
		move bounding box to new targetPos and targetEuler
		"""
		targetPos = BB.checker.getPosition(viz.ABS_GLOBAL)
		targetEuler = BB.checker.getEuler(viz.ABS_GLOBAL)
		if (animate):
			move = vizact.moveTo(pos = targetPos, time = time, mode = viz.ABS_GLOBAL)
			spin = vizact.spinTo(euler = targetEuler, time = time, mode = viz.ABS_GLOBAL)
			transition = vizact.parallel(spin, move)
			self.addAction(transition)
		else:
			self.setPosition(targetPosition, viz.ABS_GLOBAL)
			self.setEuler(targetEuler,viz.ABS_GLOBAL)
示例#37
0
文件: pit.py 项目: vhilab/VRITS-2015
def TogglePit():
	"""Toggle raising/lowering of pit"""
	pit.lowered = not pit.lowered
	if pit.lowered == True:
		cackle_sound.play()
	pos = pit.positions[pit.lowered]
	pit.audio_running.play()
	pit.runAction(vizact.moveTo(pos,speed=2.0))
	pit.addAction(vizact.call(pit.audio_stop.play))
	pit.addAction(vizact.call(pit.audio_running.pause))
	# Use pit color to blend between lower/upper lightmaps
	duration = pit.getActionInstance().getDuration()
	color = pit.colors[pit.lowered]
	pit.runAction(vizact.fadeTo(color,time=duration),pool=1)
示例#38
0
    def startTrainDynamic(self):
        if len(self.trainObj) == 0:
            return

        print("start movin")

        cntr = 0
        for obj in self.trainObj:
            pos = obj.getPosition(viz.ABS_GLOBAL)

            if pos[2] == self.offPosition:
                pos[2] = pos[2] - self.offPosition
            else:
                pos[2] = pos[2] + self.offPosition

            obj.runAction(vizact.moveTo(pos, obj.getPosition(), 3))
示例#39
0
    def sendTrainByIdx(self, idx):
        self.updateOrderList()

        if idx < len(self.trainObj) and idx < len(
                self.trainCoordinates) and self.trainObj[
                    idx] not in self.travellingTrains and self.trainObj[
                        idx] not in self.forcedTrains:
            pos = [self.trainCoordinates[idx][0], 0, self.offPosition]
            self.trainObj[idx].runAction(
                vizact.moveTo(pos, self.trainObj[idx].getPosition(), 4, 50,
                              vizact.easeInOutQuadratic))

            self.travellingTrains.append(self.trainObj[idx])
        else:
            print("TrainManager.sendTrainByIdx: " + str(idx) +
                  " no index in " + str(len(self.trainCoordinates)))
示例#40
0
    def orderTrainByIdx(self, idx, force=False):
        self.updateOrderList()

        if idx < len(self.trainObj) and idx < len(self.trainCoordinates) and (
                self.trainObj[idx] not in self.travellingTrains
                or force == True):
            pos = [
                self.trainCoordinates[idx][0], 0, self.trainCoordinates[idx][1]
            ]
            self.trainObj[idx].runAction(
                vizact.moveTo(pos, self.trainObj[idx].getPosition(), 4, 50,
                              vizact.easeInOutQuadratic))

            self.trainObj[idx].visible(viz.ON)

            self.travellingTrains.append(self.trainObj[idx])
        else:
            print("TrainManager.orderTrainByIdx: " + str(idx) +
                  " no index in " + str(len(self.trainCoordinates)))
示例#41
0
	def disperseRandom(self, nodes, animate = False):
		for m in nodes:
			angle	= random.random() * 2 * math.pi
			radius	= random.random() + 1.5
			
			targetPosition	= [math.sin(angle) * radius, math.cos(angle) * radius, -1.0]
			targetEuler		= m.getEuler()
#			targetEuler		= [0.0,90.0,180.0]
			#targetEuler	= [(random.random()-0.5)*40,(random.random()-0.5)*40 + 90.0, (random.random()-0.5)*40 + 180.0]
			
			if (animate):
				move = vizact.moveTo(targetPosition, time = 2)
				spin = vizact.spinTo(euler = targetEuler, time = 2)
				transition = vizact.parallel(spin, move)
				m.addAction(transition)
			else:					
				m.setPosition(targetPosition)
				m.setEuler(targetEuler)
				
			if isinstance(m, BoundingBox):
				m.disperseMembers()
示例#42
0
    for i in range(1, 39)
])
screen = viz.addTexQuad()
screen.setPosition([0, 2.67, 6.33])
screen.setScale([0.789 * 3.01, 0.62 * 2.19, 1])

# ギークラボ長野へようこそ
text3D = viz.addText3D('welcome to geeklab NAGANO',
                       pos=[0, 2.3, 2],
                       align=viz.ALIGN_CENTER_BOTTOM,
                       color=viz.YELLOW,
                       scale=[0.1, 0.05, 0.1],
                       font='Comic Sans MS')

text3D.add(
    vizact.sequence(vizact.moveTo((0, 2.0, 2), speed=0.1),
                    vizact.moveTo((0, 2.3, 2), speed=0.1), viz.FOREVER))

# 取得元のURL http://dova-s.jp/bgm/play3394.html
sound = viz.addAudio('sound/基地出撃5分前.mp3', viz.LOOP, volume=0.1)
sound.volume(.1)
sound.play()


# ギークラボ長野紹介プレゼン資料表示
def NextMovieFrame():
    screen.texture(movieImages.next())


vizact.ontimer(5.0 / 1, NextMovieFrame)
示例#43
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
示例#44
0
def TogglePlatform():
    """Toggle raising/lower of platform"""
    platform.raised = not platform.raised
    pos = platform.positions[platform.raised]
    platform.runAction(vizact.moveTo(pos, speed=2.0))
示例#45
0
 def move(self, x, y, z, s):
     action1 = vizact.moveTo([x, y, z], speed=s)
     self.node.addAction(action1)
     self.x = x
     self.y = y
     self.z = z
示例#46
0
grid.color(viz.GREEN)
viz.clearcolor(viz.BLACK)

viz.mouse.setTrap(True)  #アプリ内でしか動けなくなる
viz.mouse.setVisible(False)
viz.mouse.setOverride(viz.ON)

text3D = viz.addText3D(u'Press Enter Key',
                       pos=[0, 2.2, 2],
                       align=viz.ALIGN_CENTER_BOTTOM,
                       color=viz.WHITE,
                       scale=[0.1, 0.05, 0.1],
                       font='Times New Roman')
text3D.setEncoding(viz.ENCODING_UTF8)
text3D.add(
    vizact.sequence(vizact.moveTo((0, 2.1, 2), speed=0.03),
                    vizact.moveTo((0, 2.2, 2), speed=0.03), viz.FOREVER))
text3D.setThickness(0.001)


def myTask():
    sound = viz.addAudio('sound/samplerButton.wav')
    sound.play()

    fadeout = vizact.fadeTo(0, time=2)
    yield text3D.addAction(fadeout)
    yield text3D.disable(True)
    yield grid.addAction(fadeout)
    yield viztask.waitTime(3)
    # ここでGLNAGANOのロゴ表示
    import opning