Esempio n. 1
0
def addPigeonToWorld(info):
	pigeon = vizfx.addAvatar(info.PIGEON_FILE, pos=info.startPosition)
	pigeon.setScale(3,3,3) # So that the pigeons are easier to see
	pigeon.state(info.state)
	if info.coordinates != None:
		action = vizact.sequence([vizact.walkTo(c, walkSpeed=info.speed, turnSpeed=info.turnSpeed, walkAnim=info.state, turnInPlace=True) for c in info.coordinates], viz.FOREVER)
		pigeon.runAction(action)
    def rotate(object_to_rotate, duration, markerstream):
        """
        Rotates a 3d object by a randomly chosen angle between 1 and 360 degree.

        Args:
            object_to_rotate: any 3d node object
            duration: duration of the rotation in seconds
            markerstream: LSL markerstream to push rotate value

        Returns:

        """

        rotate_val = random.randint(1, 360)
        markerstream.push_sample(['ground_rotate'])
        markerstream.push_sample(['ground_rotate_angle,' + str(rotate_val)])
        spinto = vizact.spinTo(euler=(rotate_val, 0, 0),
                               time=0,
                               mode=viz.REL_GLOBAL)
        fadeout = vizact.fadeTo(0, time=duration)
        fadein = vizact.fadeTo(1, time=duration)

        fadeinout = vizact.sequence(fadeout, spinto, fadein)
        object_to_rotate.addAction(fadeinout)
        markerstream.push_sample(
            ['object_fadeInOut, duration:' + str(duration)])
Esempio n. 3
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))
Esempio n. 4
0
def reachTeapotTask():
	tryNum = 0
	while(True) :
		global reachedTeapot
		reachedTeapot = False
		global avoidCat
		avoidCat = True

		# Action for hiding/showing text
		DelayHide = vizact.sequence( vizact.waittime(8), vizact.method.visible(False) )
		Show = vizact.method.visible(True)

		instructions.setText("Welcome!")
		instructions.runAction(DelayHide)
		yield viztask.waitTime(5)
		instructions.runAction(Show)
		instructions.setText("Now, try to get the teapot without touching the cat in 15 seconds!")
		instructions.runAction(DelayHide)
		yield viztask.waitTime(15)
		instructions.runAction(Show)

		instructions.setText("Reached Teapot: "+str(reachedTeapot)+" Avoided Cat: "+str(avoidCat))
		yield viztask.waitTime(5)
		yield ClapTask()
		tryNum = tryNum + 1
		data = 'Try '+str(tryNum)+' Reached Teapot: '+str(reachedTeapot)+' Avoided Cat: '+str(avoidCat)+'\n'
		teapot_game_data.write(data)
		instructions.setText("Now, try again or exit to leave!")
		yield viztask.waitTime(5)
Esempio n. 5
0
def fadeAndAppear(): 
	global screen, fadeInAndOut, selector, phoneEvent
	yield viztask.waitTime(3)
	yield screen.playsound('resources/audio/vibrate.wav', viz.LOOP)
	selector.enable()
	fadeInAndOut = vizact.sequence([vizact.fadeTo(0, time=0.5), vizact.fadeTo(1,time=0.5)], viz.PERPETUAL)
	phoneEvent = vizact.onmousedown(viz.MOUSEBUTTON_LEFT, selectPhone)
	screen.addAction( fadeInAndOut ) 
def FallAction():
	"""Flashes screen red and animates blur effect"""

	flash_quad.visible(True)
	flash_quad.color(viz.RED)
	fade_out = vizact.fadeTo(viz.BLACK,time=2.5)
	flash_quad.runAction(vizact.sequence(fade_out,vizact.method.visible(False)))
	flash_quad.runAction(vizact.call(blurEffect.setDistance,vizact.mix(50,0,time=2.5)),pool=1)
def FallAction():
	"""Flashes screen red and animates blur effect"""

	flash_quad.visible(True)
	flash_quad.color(viz.RED)
	fade_out = vizact.fadeTo(viz.BLACK,time=2.5)
	flash_quad.runAction(vizact.sequence(fade_out,vizact.method.visible(False)))
	flash_quad.runAction(vizact.call(blurEffect.setDistance,vizact.mix(50,0,time=2.5)),pool=1)
Esempio n. 8
0
def FlashScreen():
    """Flash screen and fade out"""
    flash_quad.visible(True)
    flash_quad.color(viz.WHITE)
    fade_out = vizact.fadeTo(viz.BLACK,
                             time=FLASH_TIME,
                             interpolate=vizact.easeOutStrong)
    flash_quad.runAction(
        vizact.sequence(fade_out, vizact.method.visible(False)))
Esempio n. 9
0
File: Test.py Progetto: kevinsp/DvB
def pigeonsFeed():

    random_speed = vizact.method.setAnimationSpeed(0,vizact.randfloat(0.7,1.5))
    random_walk = vizact.walkTo(pos=[vizact.randfloat(-4,4),0,vizact.randfloat(3,7)])
    random_animation = vizact.method.state(vizact.choice([1,3],vizact.RANDOM))
    random_wait = vizact.waittime(vizact.randfloat(5.0,10.0))
    pigeon_idle = vizact.sequence( random_speed, random_walk, random_animation, random_wait, viz.FOREVER)

    for pigeon in pigeons:
        pigeon.addAction(pigeon_idle)
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)
def moveToDash(node):
	if (node == cup1):#cup1
		move = vizact.sequence(vizact.moveTo([-.70,1.4,-2.4],speed=.5),vizact.moveTo([.69,1.4,-2.4],speed=.5), vizact.moveTo([.69,1.23,-2.76],speed=.5))
		node.addAction(move)
		yield viztask.waitActionEnd(node,move)
		viz.sendEvent(FINDING_TASK_OVER_EVENT, SCENE)
	elif (node == toothBrush or node == bristles): #toothbrush
		move = vizact.sequence(vizact.moveTo([7,10,-3],speed=5), vizact.moveTo([10,13.5,-15],speed=5))
		toothBrush.addAction(move)
		bristles.addAction(move)
		yield viztask.waitActionEnd(bristles,move)
	elif (node == toothPaste or node == cap): #toothpaste
		move = vizact.sequence(vizact.moveTo([0,1,10],speed=7),vizact.moveTo([18,1,-3],speed=7))
		toothPaste.addAction(move)
		cap.addAction(move)
		yield viztask.waitActionEnd(cap,move)
	elif (node == bottle1 or node == bottleCap1):#bottle 1
		move = vizact.moveTo([0,-17.5, -8], time=1)
		spin = vizact.spinTo(euler=[0,25,0], time = 1)
		spinMove = vizact.parallel(spin, move)
		move = vizact.sequence(spinMove, vizact.moveTo([15,-13,-6],speed=8), vizact.moveTo([15,-3,-6],speed=8), vizact.moveTo([18,-5,-17],speed=8))
		bottle1.addAction(move)
		bottleCap1.addAction(move)
		yield viztask.waitActionEnd(bottle1,move)
	elif (node == bottle2 or node == bottleCap2): #bottle 2
		move = vizact.sequence(vizact.moveTo([7,12,-3],speed=5), vizact.moveTo([8,12,-14],speed=5))
		bottle2.addAction(move)
		bottleCap2.addAction(move)
		yield viztask.waitActionEnd(bottle2,move)
	elif (node == cup2): #cup 2
		move = vizact.sequence(vizact.moveTo([0,2.5,0],speed=5),vizact.moveTo([15,2.5,0],speed=5), vizact.moveTo([15,0,0],speed=5))
		node.addAction(move)
		yield viztask.waitActionEnd(node,move)
		viz.sendEvent(FINDING_TASK_OVER_EVENT, SCENE)
Esempio n. 12
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)
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])
Esempio n. 14
0
def destinationsTask():

    # Action for hiding/showing text
    DelayHide = vizact.sequence( vizact.waittime(8), vizact.method.visible(False) )
    Show = vizact.method.visible(True)

    yield viztask.waitTime(6)
    instructions.setText("Walk around!")
    instructions.runAction(DelayHide)
    yield viztask.waitTime(30)
    instructions.runAction(Show)
    instructions.setText("Thank you for your participation :)")

    #Show results of experiment
    print 'Avoided avatar:',avoidAvatar
    print 'Avoided cat:',avoidCat
Esempio n. 15
0
 def flash(self):
     """Flashes screen red and animates blur effect"""
     with viz.cluster.MaskedContext(self._clientMask):
         self._flashSphere.visible(True)
         self._flashSphere.color(self._color)
         self._flashSphere.disable(viz.LIGHTING)
         self._flashSphere.disable(viz.SHADOWS)
         self._flashSphere.disable(viz.SHADOW_CASTING)
         self._flashSphere.enable(viz.BLEND)
         self._flashSphere.disable(viz.DEPTH_TEST)
         self._flashSphere.disable(viz.DEPTH_WRITE)
         self._flashSphere.alpha(0.5)
         self._flashSphere.drawOrder(101, bin=viz.BIN_TRANSPARENT)
     fade_out = vizact.fadeTo(0, begin=.3, time=1)
     self._flashSphere.runAction(
         vizact.sequence(fade_out, vizact.method.visible(False)))
Esempio n. 16
0
def destinationsTask():

    # Action for hiding/showing text
    DelayHide = vizact.sequence( vizact.waittime(8), vizact.method.visible(False) )
    Show = vizact.method.visible(True)

    yield viztask.waitTime(12)
    instructions.setText("Walk to the potted plant directly ahead on the opposite side of the courtyard.")
    instructions.runAction(DelayHide)
    yield vizproximity.waitEnter(plantSensor)
    instructions.runAction(Show)
    instructions.setText("Face the arch side of the courtyard. Walk to the piles of crates directly ahead.")
    instructions.runAction(DelayHide)
    yield vizproximity.waitEnter(cratesSensor)
    instructions.runAction(Show)
    instructions.setText("Walk into the cafe on the opposite side of the courtyard.")
    instructions.runAction(DelayHide)
    yield vizproximity.waitEnter(cafeSensor)
    instructions.runAction(Show)
    instructions.setText("Thank you for your participation.")
    #Show results of experiment
    print 'Avoided sitting avatar:',avoidSitting
    print 'Avoided standing avatar:',avoidStanding
    print 'Avoided dancing avatar:',avoidDancing
Esempio n. 17
0
	def SetMotion (self):
		#reset component position
		self.shaft.setEuler(0,0,0)
		self.rodL.setPosition(13.245,-196.394,738.167)
		self.rodR.setPosition(13.245,-196.394,738.167)
		self.rodL.setEuler(0,0,0)
		self.rodR.setEuler(0,0,0)
		self.pistonL.setPosition(13.245,-196.394,738.167)
		self.pistonR.setPosition(13.245,-196.394,738.167)
		self.pistonL.setEuler(0,0,0)
		self.pistonR.setEuler(0,0,0)
		#self.wheel.setEuler(0,0,0)
		self.gear.addAction(vizact.spin(0,0,1, 90,viz.FOREVER))
		self.shaft.addAction(vizact.spin(0,0,1,-36,viz.FOREVER))
		#set the left rod's action (rotation and transform)
		moveRodUp = vizact.moveTo([13.245,-130,738.167], time=5)
		moveRodDown = vizact.moveTo([13.245,-196.394,738.167], time=5)
		rodLTransform = vizact.sequence([moveRodUp, moveRodDown], viz.FOREVER)
		spinRodFw = vizact.spin(0,0,1, 2, 2.5)
		spinRodBw = vizact.spin(0,0,1, -2, 2.5)
		rodLRotation = vizact.sequence([spinRodFw, spinRodBw, spinRodBw, spinRodFw], viz.FOREVER)
		rodLMotion = vizact.parallel(rodLTransform, rodLRotation)
		#set the right rod's action (rotation and transform)
		moveRodRUp = vizact.moveTo([13.245,-196.394,738.167], time=5)
		moveRodRDown = vizact.moveTo([13.245,-262,738.167], time=5)
		rodRTransform = vizact.sequence([moveRodRDown, moveRodRUp], viz.FOREVER)
		rodRRotation = vizact.sequence([spinRodBw, spinRodFw, spinRodFw, spinRodBw], viz.FOREVER)
		rodRMotion = vizact.parallel(rodRTransform, rodRRotation)
		# start moving the rods
		self.rodL.addAction(rodLMotion)
		self.rodR.addAction(rodRMotion)
		# start moving the pistons
		pistonLTransform = vizact.sequence([moveRodUp, moveRodDown], viz.FOREVER)
		self.pistonL.addAction(pistonLTransform)
		pistonRTransform = vizact.sequence([moveRodRDown, moveRodRUp], viz.FOREVER)
		self.pistonR.addAction(pistonRTransform)
Esempio n. 18
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
    yield opning.Logo()
Esempio n. 19
0
def addAvatarToWorld(info):
	person = vizfx.addAvatar(info.avatarFile, pos=info.startPosition, euler=info.euler)
	person.state(info.state)
	if info.coordinates != None:
		action = vizact.sequence([vizact.walkTo(c, walkSpeed=info.speed, turnSpeed=info.turnSpeed, walkAnim=info.state, turnInPlace=True) for c in info.coordinates], viz.FOREVER)
		person.runAction(action)
Esempio n. 20
0
def FlashScreen():
    """Flash screen and fade out"""
    flash_quad.visible(True)
    flash_quad.color(viz.WHITE)
    fade_out = vizact.fadeTo(viz.BLACK,time=FLASH_TIME,interpolate=vizact.easeOutStrong)
    flash_quad.runAction(vizact.sequence(fade_out,vizact.method.visible(False)))
Esempio n. 21
0
def cityScene():
 global city, skyDome2, CRYSTAL_EVENT, moleculeList, rightHandTarget, leftHandTarget
 global mole1, mole2, mole3
 global mole4, mole5, mole6, mole7, mole8, mole9, mole10, mole11
 print "city scene starting"
 globals_oa.CITY_SCENE_AMBIENT.play()
 city.enable(viz.RENDERING)
 viz.fog(0)
 arrow = city.getChild('greenArrow.OSGB')
 arrow.disable(viz.RENDERING)
 tube = city.getChild('yellowTube.OSGB')
 tube.disable(viz.RENDERING)

 yield globals_oa.fader.fadeInTask()
# yield viztask.waitTime(3)
 yield viztask.waitAny([viztask.waitTime(3), skipKey])
# carAudio1 = globals_oa.CAR_SCENE1
# carAudio1.play()
## yield viztask.waitMediaEnd(carAudio1)
# yield viztask.waitAny([viztask.waitTime(10), skipKey])
 carAudio2 = globals_oa.CAR_SCENE2
 carAudio2.play()
 arrow.enable(viz.RENDERING)
 fadeIn = vizact.fadeTo(1, time=1)
 fadeOut = vizact.fadeTo(0, time=1)
 sequence = vizact.sequence(fadeIn, fadeOut, viz.FOREVER)
 arrow.add(sequence)
# yield viztask.waitMediaEnd(carAudio2) 
 yield viztask.waitAny([viztask.waitTime(7), skipKey])
 carAudio3 = globals_oa.CAR_SCENE3
 carAudio3.play()
 arrow.disable(viz.RENDERING)
 manager = vizproximity.Manager()
 manager.setDebug(False)
 rightHandTarget = vizproximity.Target(globals_oa.rightHand)
 leftHandTarget = vizproximity.Target(globals_oa.leftHand)
 car1 = city.getChild('BlueCar.OSGB')
 exhaust = city.getChild('p_silencer-OFFSET')
 car1Sensor = vizproximity.Sensor(vizproximity.Box([0.5,0.7,0.4], center=[1.4,4.2,0]), source=exhaust)
 manager.addTarget(rightHandTarget)
 manager.addTarget(leftHandTarget)
 manager.addSensor(car1Sensor)
 tube.enable(viz.RENDERING)
 tube.add(sequence)
# car1Sensor = vizproximity.Sensor(vizproximity.Box([3.3,1.6,1.8], center=[5,0.4,-10.5]), source=car1)
 
 if carAudio3.audioObj.getState() == viz.MEDIA_RUNNING:
#  yield viztask.waitMediaEnd(carAudio3)
  yield viztask.waitAny([viztask.waitTime(4), skipKey])
# manager.addTarget(rightHandTarget)
# manager.addTarget(leftHandTarget)
# manager.addSensor(car1Sensor)
# CAR_TOUCHED = False
 failAudio = globals_oa.CAR_FAIL_AUDIO
 failAudio.stop()
 failTimer = vizact.ontimer(5 + failAudio.getDuration(), playWrapper, failAudio)
 #yield vizproximity.waitEnter(car1Sensor)

 
 def vibrateRightHand():
  globals_oa.rhViveTracker.setVibration(0.004)
 def vibrateLeftHand():
  globals_oa.lhViveTracker.setVibration(0.004)
 def onEnter(e): 
  global rightHandTarget, leftHandTarget
  print 'working'
  if e.target == rightHandTarget:
    vizact.ontimer2(.004, 100, vibrateRightHand)
  if e.target == leftHandTarget:
    vizact.ontimer2(.004, 100, vibrateLeftHand)
 manager.onEnter(car1Sensor, onEnter)
 
 def startCar1():
  global mole1, mole2, mole3, moleculeList
  mole1 = vizfx.addChild(globals_oa.FILE_PATH_TO_MOLECULE1)
  moleculeList.append(mole1)
  mole1.setPosition([-1.2, 0.35, -0.08])
  mole1.setScale([3,3,3])
  mole1.setAnimationSpeed(3)
  mole1.setEuler(-90,0,0)
  mole2 = vizfx.addChild(globals_oa.FILE_PATH_TO_MOLECULE2)
  moleculeList.append(mole2)
  mole2.setPosition([-1.1,0.3,0])
  mole2.setScale([3,3,3])
  mole2.setAnimationSpeed(2.1)
  mole2.setEuler(-90,0,0)
  mole3 = vizfx.addChild(globals_oa.FILE_PATH_TO_MOLECULE2)
  moleculeList.append(mole3)
  mole3.setPosition([-1.05,0.29,-0.05])
  mole3.setScale([3,3,3])
  mole3.setAnimationSpeed(5)
  mole3.setEuler(-90,0,0)
 def floatersGo():
  global mole4, mole5, mole6, mole7, mole8, mole9, mole10, mole11, moleculeList
  mole4 = vizfx.addChild(globals_oa.FILE_PATH_TO_MOLECULE1)
  moleculeList.append(mole4)
  mole4.setPosition([-.2,2.9,0])
  mole4.setEuler([0,-90,0])
  mole4.setScale([3,3,3])
  mole4.setAnimationSpeed(2)
  mole5 = vizfx.addChild(globals_oa.FILE_PATH_TO_MOLECULE2)
  moleculeList.append(mole5)
  mole5.setPosition([-.2,2.9,0])
  mole5.setEuler([90,-90,0])
  mole5.setScale([3,3,3])
  mole5.setAnimationSpeed(2)
  mole6 = vizfx.addChild(globals_oa.FILE_PATH_TO_MOLECULE1)
  moleculeList.append(mole6)
  mole6.setPosition([-.2,2.9,0])
  mole6.setEuler([180,-90,0])
  mole6.setScale([3,3,3])
  mole6.setAnimationSpeed(2)
  mole7 = vizfx.addChild(globals_oa.FILE_PATH_TO_MOLECULE2)
  moleculeList.append(mole7)
  mole7.setPosition([-.2,2.9,0])
  mole7.setEuler([-90,-90,0])
  mole7.setScale([3,3,3])
  mole7.setAnimationSpeed(2)
  mole8 = vizfx.addChild(globals_oa.FILE_PATH_TO_MOLECULE2)
  moleculeList.append(mole8)
  mole8.setPosition([-.2,2.9,0])
  mole8.setEuler([-45,-90,0])
  mole8.setScale([3,3,3])
  mole8.setAnimationSpeed(2)
  mole9 = vizfx.addChild(globals_oa.FILE_PATH_TO_MOLECULE2)
  moleculeList.append(mole9)
  mole9.setPosition([-.2,2.9,0])
  mole9.setEuler([45,-90,0])
  mole9.setScale([3,3,3])
  mole9.setAnimationSpeed(2)
  mole10 = vizfx.addChild(globals_oa.FILE_PATH_TO_MOLECULE2)
  moleculeList.append(mole10)
  mole10.setPosition([-.2,2.9,0])
  mole10.setEuler([-135,-90,0])
  mole10.setScale([3,3,3])
  mole10.setAnimationSpeed(2)
  mole11 = vizfx.addChild(globals_oa.FILE_PATH_TO_MOLECULE2)
  moleculeList.append(mole11)
  mole11.setPosition([-.2,2.9,0])
  mole11.setEuler([135,-90,0])
  mole11.setScale([3,3,3])
  mole11.setAnimationSpeed(2)
 def goSpecialMole():
  global specialMole
  yield viztask.waitTime(1)
  specialMole = vizfx.addChild(globals_oa.FILE_PATH_TO_MOLECULE3)
  specialMole.setPosition([-1.33023,0.35456,-0.04151])
  specialMole.setScale([4,4,4])
  lowPolyMole = specialMole.getChild('singleCO2_noAnimation.OSGB')
  lowPolyMole.disable(viz.RENDERING)
  path = viz.addAnimationPath()
  path.addControlPoint(0, pos=[-1.33023,0.35456,-0.04151], euler=(90,0,0), scale= ([4,4,4]))
  path.addControlPoint(1, pos=[-1,0.4, 0], euler=(45,0,0), scale = ([4,4,4]))
  path.addControlPoint(2, pos=[-0.8,0.9,0.1], euler=(0,0,0), scale = ([4,4,4]))
  path.addControlPoint(3, pos=[-0.4,1.3,0.2], euler=(90,0,0), scale = ([4,4,4]))
  pathLink = viz.link(path, specialMole)
  path.play()
 def flyOut():
  global specialMole, skipKey
  yield viztask.waitTime(1)
  path = viz.addAnimationPath()
  path.addControlPoint(0, pos=[-0.4,1.3,0.2], euler=(90,0,0), scale= ([4,4,4]))
  path.addControlPoint(1, pos=[-0.4,1.5,0.6], euler=(55,0,0), scale= ([4,4,4]))
  path.addControlPoint(2, pos=[-0.4,3.3,0.1], euler=(100,0,0), scale= ([4,4,4]))
  path.addControlPoint(3, pos=[-0.4,4.8,0.8], euler=(75,0,0), scale= ([4,4,4]))
  path.addControlPoint(50, pos=[-0.4,70,0.4], euler=(90,0,0), scale = ([4,4,4]))
  pathLink = viz.link(path, specialMole)
  path.play()
# yield viztask.waitKeyDown('/')
 yield vizproximity.waitEnter(car1Sensor)
 failTimer.remove()
 tube.disable(viz.RENDERING)
 globals_oa.CAR_START.play()
 things = vizact.ontimer2(1,10, startCar1)
 yield things
 yield vizact.waittime(1.5)
 things2 = vizact.ontimer2(1,10, floatersGo)
 globals_oa.CAR_SCENE4.play()
 yield things2
 yield vizact.waittime(1.5)
# yield viztask.waitMediaEnd(globals_oa.CAR_SCENE4)
 yield viztask.waitAny([viztask.waitTime(15), skipKey])
 yield goSpecialMole()
 viztask.waitTime(3)
 globals_oa.CAR_SCENE5.play()
# yield viztask.waitMediaEnd(globals_oa.CAR_SCENE5)
 yield viztask.waitAny([viztask.waitTime(6), skipKey]) 
 yield flyOut()
 yield viztask.waitTime(6)
# childList = range(1,160)
# for child in childList:
#  object = viz.VizChild(child)
#  object.remove()
 for mole in moleculeList:
  mole.remove()

 yield globals_oa.fader.fadeOutTask()
 globals_oa.CITY_SCENE_AMBIENT.stop()
 city.remove()

 
 print "sending city end event"
 viz.sendEvent(globals_oa.CITY_SCENE_END_EVENT)
Esempio n. 22
0
def react():
	male.state(2)
	wait = vizact.waittime(3)
	scratchAndShrug = vizact.sequence(wait, vizact.animation(4),vizact.animation(6))
	male.add(scratchAndShrug)
Esempio n. 23
0
# Create a cat
cat = viz.addAvatar('cat_tabby_high.cfg')
cat.setPosition(2,0,5)
cat.state(1)

# Add idle animation
#random_walk = vizact.walkTo(pos=[vizact.randfloat(-0.5,0.5),0,vizact.randfloat(-0.5,0.5)])
#random_animation = vizact.method.state(vizact.choice([1,3],vizact.RANDOM))
#random_wait = vizact.waittime(vizact.randfloat(4.0,8.0))
#pigeon_idle = vizact.sequence( random_walk, random_animation, random_wait, viz.FOREVER)
#pigeon.runAction(pigeon_idle)

randomTime = vizact.randfloat(0.5,3.0)
randomWait = vizact.waittime(randomTime)
runAwayAction = vizact.sequence(randomWait, runAway(viz.MainView), viz.FOREVER)

# Adding sound to pigeon
hooting = pigeon.playsound('birds.wav',viz.LOOP)
hooting.pause()

# Create flash screen quad
flash_quad = viz.addTexQuad(parent=viz.ORTHO)
flash_quad.color(viz.WHITE)
flash_quad.drawOrder(-10)
flash_quad.blendFunc(viz.GL_ONE,viz.GL_ONE)
flash_quad.visible(False)
flash_quad.setBoxTransform(viz.BOX_ENABLED)

# Create status bar background
status_bar = viz.addTexQuad(parent=viz.ORTHO)
Esempio n. 24
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)

Esempio n. 25
0
	def stageAxes(self, NAxes, relSpeed, holes):
		# Function for swinging the axes
		def swing(object, t, startAngle, endAngle):
			d = (math.sin(t[0]) + 1.0) / 2.0
			angle = startAngle + d * (endAngle - startAngle)
			object.setEuler([90,0,angle])
			t[0] += 0.03 * relSpeed
		
		# Add axes
		beginPosition = 400
		endPosition = 6600
		nrAxes = NAxes
		self.axes = []
		self.axest = []
		self.swoosh = []
		for i in range(nrAxes):
			self.axes.append(viz.addChild('axe.OSGB', cache=viz.CACHE_CLONE))
			self.axes[i].setPosition([beginPosition+i*(endPosition/nrAxes),750,0], viz.REL_LOCAL)
			self.axest.append([float(i)])
			
			sound_node = viz.addGroup(pos=[beginPosition+i*(endPosition/nrAxes),75,0])
			self.swoosh.append(sound_node.playsound('swoosh.wav'))
			self.swoosh[i].minmax(0, 20)
			vizact.ontimer(3.14/relSpeed, self.swoosh[i].play)
			
			vizact.ontimer(0.03, swing, self.axes[i], self.axest[i], 120, 240)
		
		# Add ducky
		self.newduck = viz.addAvatar('duck.cfg')
		self.newduck.setScale([170,170,170])
		self.newduck.setPosition([7200,0,0],viz.REL_LOCAL)
		self.newduck.setEuler([-90,0,0])

		# Add proximity sensors
		manager = vizproximity.Manager()
		target = vizproximity.Target(viz.MainView)
		manager.addTarget(target)
		self.axesensors = []
		for i in range(nrAxes):
			self.axesensors.append(vizproximity.addBoundingBoxSensor(self.axes[i]))
			manager.addSensor(self.axesensors[i])
		duckSensor = vizproximity.addBoundingBoxSensor(self.newduck,scale=(2.5,2.5,3))
		manager.addSensor(duckSensor)
		
		# Boolean variables to store trial results
		self.axesHit = []
		for i in range(nrAxes):
			self.axesHit.append(0)
			
#		for i in range(nrAxes):
#			sensors.append(vizproximity.addBoundingBoxSensor(self.axes[i]))
#			manager.addSensor(sensors[i])
		
		holeCoordinates = [
		[755,0,95],
		[755,0,-98],
		[1391,0,-1.5],
		[2017,0,98],
		[2503,0,-5],
		[2987,0,-108],
		[3776,0,-55],
		[4726,0,49],
		[5525,0,95],
		[5525,0,-104],
		[6011,0,-7]]
		
		self.holesensor = []
		k=-1
		for hole in holeCoordinates:
			k+=1
			self.holesensor.append(vizproximity.Sensor(vizproximity.Box([50,300,100],center=hole),source=viz.Matrix.translate(0,0,0)))
			manager.addSensor(self.holesensor[k])
			
		
		self.holesHit = []
		for i in range(len(self.holesensor)):
			self.holesHit.append(0)
		
		# Called when we enter a proximity
		def EnterProximity(e):
			for i in range(nrAxes):
				if e.sensor == self.axesensors[i]:
					self.axesHit[i] += 1
					print "Hit axe #" + str(i) + " " + str(self.axesHit[i]) + " times!"
			
			if holes:
				for i in range(len(self.holesensor)):
					if e.sensor == self.holesensor[i]:
						self.holesHit[i] += 1
						print "Hit hole #" + str(i) + " " + str(self.holesHit[i]) + " times!"
		
		manager.onEnter(None,EnterProximity)
		
		#Add info panel to display messages to participant
		self.instructions = vizinfo.InfoPanel(icon=False,key=None)
		
		vizact.onkeydown('g',manager.setDebug,viz.TOGGLE)  
		
		# Action for hiding/showing text
		DelayHide = vizact.sequence( vizact.waittime(8), vizact.method.visible(False) )
		Show = vizact.method.visible(True)
		
		#instructions.setText("Reach the duck."+str(self.time))
		self.startTime = viz.tick()
		
		
		print "done with scene, awaiting duck"
		print "----------Begin stage "+str(self.stage)+"----------"
		# When finished
		yield vizproximity.waitEnter(duckSensor)
		
		self.elapsedTime = viz.tick() - self.startTime
		self.elapsedTime = str(round(self.elapsedTime,2))
		yayString = "Total number of axes hit: "
		if NAxes>0: yayString += str(self.axesHit[0])
		for i in range(1, nrAxes):
			yayString += ", " + str(self.axesHit[i])
		if holes:
			yayString += ".\nTotal number of holes hit: "
			for i in range(len(self.holesensor)):
				yayString += ", " + str(self.holesHit[i])
		
		yayString += ".\nTime is: " + str(self.elapsedTime)	
		print yayString
		self.tracking_data.write(yayString)
		print "----------End stage----------"
Esempio n. 26
0
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]:
		male = viz.addAvatar('vcc_male.cfg')
		female = viz.addAvatar('vcc_female.cfg')
Esempio n. 27
0
import viz
import vizact
viz.go()

#Example for creating a fan of triangles: 
viz.startLayer(viz.TRIANGLE_FAN)  
viz.vertex(0,1,5) #All the triangles have the first vertex as a point. 
viz.vertex(-1.5,1.35,10) #The other points are taken in pairs. 
viz.vertex(-.25,1.5,10) 
viz.vertex(0,.8,10) 
viz.vertex(.25,1.5,10) 
viz.vertex(1.5,1.35,10) 
myTrianglefan = viz.endLayer()  

#Notify Vizard that the layer will be modified frequently. 
myTrianglefan.dynamic() 

#Grab a vertex. 
tip = myTrianglefan.Vertex( 0 ) 
fadeInAndOut = vizact.sequence( [vizact.fadeTo(viz.RED,time=1),vizact.fadeTo(viz.WHITE,time=1)], viz.PERPETUAL ) 
#Apply an action to the vertex. 
tip.addAction( fadeInAndOut ) 
Esempio n. 28
0
day.renderToBackground()

male = viz.addAvatar('resources/CC2_m001_hipoly_A1_v2.cfg',pos=(-6.5,0,8),euler=(180,0,0))
male.state(3)

startedWalking = False

female = viz.addAvatar('resources/CC2_f020_hipoly_A1_v2.cfg',pos=FEMALE_POSITION,euler=(-90,0,0))
female.state(3)

pigeon = viz.addAvatar('pigeon.cfg', pos=PIGEON_POSITION)
pigeon.setScale(2,2,2)
pigeon.setEuler(random.randint(120, 180))
randomAnimation = vizact.method.state(vizact.choice([1,3], vizact.RANDOM))
randomWait = vizact.waittime(vizact.randfloat(2,3))
pigeon_idle = vizact.sequence(randomAnimation, randomWait, viz.FOREVER)
pigeon.runAction(pigeon_idle)

#pigeonSensor = vizproximity.Sensor(vizproximity.Sphere(5, center=PIGEON_POSITION), source=pigeon)
pigeonSensor = vizproximity.Sensor(vizproximity.Box([1.5,3,1.5]),source=pigeon)
target = vizproximity.Target(male)

manager = vizproximity.Manager()
manager.addSensor(pigeonSensor)
manager.addTarget(target)

def pigeonRun(e):
	runAction = vizact.walkTo([vizact.randfloat(2,4), 0, vizact.randfloat(3, 6)], 4)
	pigeon.runAction(runAction)
	pigeon.addAction(pigeon_idle)
Esempio n. 29
0
        viz.SCREEN)
    textScreen.alignment(viz.ALIGN_RIGHT_BOTTOM)
    textScreen.setScale(0.2, 0.2, 0.2)
    textScreen.setPosition([0.95, 0.05, 0])


def textScreen2():

    textScreen = viz.addText(
        'school bus, students who are travelling in this bus are rich and excellent in studies',
        viz.SCREEN)
    textScreen.alignment(viz.ALIGN_RIGHT_BOTTOM)
    textScreen.setPosition([0.95, 0.05, 0])


fadeInOut = vizact.sequence(vizact.fadeTo(1, time=1), vizact.waittime(4),
                            vizact.fadeTo(0, time=1))


def landmark():

    object = viz.pick()

    if object.valid() and object == bomb_in_school:
        textbox1 = viz.addTextbox()
        #Make it twice as long.
        textbox1.length(2)
        textbox1.setPosition(.5, .5)
        #Have it grow when text reaches its boundary.

        textbox1.overflow(viz.OVERFLOW_GROW)
Esempio n. 30
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. 31
0

viztask.schedule(scenesTask())

# Proximity code
manager = vizproximity.Manager()

# Add main viewpoint as proximity target
target = vizproximity.Target(viz.MainView)
manager.addTarget(target)

# Add scene1 proximity sensor
manager.addSensor(scene1.stoneSensor)

scaleAction = vizact.sequence([
    vizact.sizeTo(size=[1.3, 1.3, 1.3], time=1),
    vizact.sizeTo(size=[1, 1, 1], time=1)
], viz.FOREVER)
fadeAction = vizact.sequence([
    vizact.fadeTo([0.63, 0.32, 0.18], time=2),
    vizact.fadeTo(viz.WHITE, time=2)
], viz.FOREVER)


def onGrab(e):
    e.grabbed.runAction(fadeAction, pool=1)
    e.grabbed.runAction(scaleAction, pool=2)
    if scene2.getActive():
        scene2.music.play()
        viz.window.setPolyMode(viz.POLY_POINT)

Esempio n. 32
0
				species.append(s[0])
				numObjectsToFind.append(0)
				nodesToHuntForEachSpecies[s[0]] = []
				nodeNamesToHuntForEachSpecies[s[0]] = []
				firstItem = False
			else:
				nodeNamesToHuntForEachSpecies[s[0]].append(item)
				
#				print item
		#s = line.split('\n')
		#specieList.append(line[:-1])

fadeOut = vizact.fadeTo(0, begin = 1,  time = 2)
fadeIn = vizact.fadeTo(1, begin = 0, time = 2)
spin = vizact.spin(0,1,0, 36, 10)
display = vizact.sequence(fadeIn, spin, fadeOut)
time_text = None
score_text = None
quad = None
speciesText = None
#slate = None
#basket=None
#selector = None

def hideBasketAndStuffAttachedToIt():
	global count_text1
	global count_text2
	global count_text3
	global quad1
	global quad2
	global quad3
def moleculeFloat(molecule):
	sequence = actionsCreation(molecule)
	floatAction = vizact.sequence(sequence)
	molecule.addAction(floatAction)
Esempio n. 34
0
def goCG():
	bgcolor = [0.15*1.2, 0.67*1.2, 0.95*1.2]
	viz.clearcolor(bgcolor)
	global skipKey, egg
	flagPile = globals_oa.terrainZone1.getChild('flagPile.OSGB', viz.CHILD_REPLACE_TRANSFORM)
	fishZone1 = schooling.initialize(1)
#	yield viztask.waitEvent(globals_oa.VIDEO_END_EVENT)
	
#	loadStuffAtStartAndHideThemALL()
	
	vizact.onsensorup(globals_oa.rhViveTracker, steamvr.BUTTON_TRIGGER, printRightHandPosition)
	vizact.onsensorup(globals_oa.lhViveTracker, steamvr.BUTTON_TRIGGER, printLeftHandPosition)
	
	globals_oa.terrainZone1.visible(viz.ON)
	globals_oa.ocean.visible(viz.ON)
#	schooling.hidePercentage(0)
#	schooling.chromis_chromis.hidePercentage(0)
#	schooling.diplodus_annularis.hidePercentage(0)
#	schooling.labrus_viridis.hidePercentage(0)
#	schooling.sarpa_salpa.hidePercentage(0)
	
#	schooling.show(fishZone1)
	
#	fog = vizfx.addFogEffect(colorRamp=viz.addTexture(globals_oa.MODEL_DIRECTORY + 'FogRamp.tif'), height=1, density=(.09))
#	fog = vizfx.addFogEffect(colorRamp=viz.addTexture(globals_oa.MODEL_DIRECTORY + 'FogRamp.tif'), height=1, density=(10))
#	vizfx.getComposer().addEffect(fog)
#	viz.MainScene.enable(viz.FOG, op=viz.OP_ROOT)
	
	viz.fogcolor(viz.AZURE)
	viz.fog(0.025)
	
#	worldvizcode.initVFXforDC(globals_oa.terrainZone1) # should moved into loadAndHide?
	worldvizcode.startEffects(globals_oa.terrainZone1) #not needed?
	
	#positioning the user on the terrain
#	offsetting the user on the terrain
	y_offset = -1.5
	userPos = globals_oa.user.getPosition(viz.ABS_GLOBAL)
	globals_oa.user.setPosition([userPos[0], y_offset, userPos[2]])
	
#####** Healthy CG zone fades in**
#	terrain1Child = globals_oa.terrainZone1.getChild('Terrain_Zone009')
#	posToMoveUserTo = terrain1Child.getBoundingBox().center
#	print "posToMoveUserTo = " + str(posToMoveUserTo)
	
	if globals_oa.fader is None: globals_oa.fader = View_Fader.addFader(fadeTime=5)
	globals_oa.fader.fadeIn()

#####	#This is a healthy reef, where carbon dioxide has not yet altered seawater chemistry. 
	#
#####	#When scientists measure the health and biodiversity of a reef, they perform something called a species count. 
#####	#Today, you will be counting the number of sea snails on this part of the reef. Look at your right hand
	#
	globals_oa.TRANSITION_TO_CG.play()
	yield viztask.waitAny([viztask.waitTime(10), skipKey])
	globals_oa.CG_SCENE1_1.play()
#	getAllChildrenZone1 = viz.MainScene.getChildren(all=True)
	def fadeAllZone1():
		globals_oa.terrainZone1.alpha(0)
		globals_oa.terrainZone1.visible(viz.ON)
		worldvizcode.stopEffects()
		viz.fog(0)
		fadeInZone1 = vizact.fadeTo(1, time=2)
		yield globals_oa.terrainZone1.addAction(fadeInZone1)
#		for child in getAllChildrenZone1: 
#			child.addAction(fadeInZone1)
			
	yield viztask.waitAny([viztask.waitTime(17), skipKey])	
#	globals_oa.CG_SCENE1_1.stop()
	
	#*participant sees 3D model of sea snail rotating like a hologram*
#	if globals_oa.rhViveTracker is not None:
#	vizact.ontimer2(0.004, 25, scavengerhunt.vibrateHandController, 2)
#	leftHandVibrateTimer.setEnabled(True)
#	rightHandVibrateTimer.setEnabled(True)
	
	
	rotatingSnail.visible(viz.ON)
	snailLink = None
	vizact.ontimer2(.004, 50, vibrateRightHand)
	if globals_oa.rhViveTracker is not None:
		snailLink = viz.link(globals_oa.rhViveTracker, rotatingSnail)
		snailLink.setOffset([0.0, y_offset, 0.0])
		snailLink.preTrans([0.01,-0.03,-0.13])
		snailLink.preEuler([0,0,180])

	
	yield viztask.waitTime(11)
	

#####	#*hologram disappears, species count begins*
	if snailLink is not None: snailLink.remove()
	rotatingSnail.visible(viz.OFF)
	rotatingSnail.remove()

##### flashing the flag pile ######
	egg.visible(viz.ON)
	flashOn = vizact.fadeTo(1, time=1, interpolate=vizact.easeInOut)
	flashOff = vizact.fadeTo(0, time=1, interpolate=vizact.easeInOut)
	flashSequence = vizact.sequence(flashOn, flashOff, 5)
	egg.add(flashSequence)
	
	
	yield viztask.waitTime(11)

	globals_oa.CG_SCENE1_2.play()
	print "playing CG_SCENE1_2 now"
#	yield viztask.waitAny([viztask.waitMediaEnd(globals_oa.CG_SCENE1_2), skipKey])
	yield viztask.waitAny([viztask.waitTime(17), skipKey])
#	scavengerhunt.initialize(globals_oa.terrainZone1, globals_oa.filePathToSpeciesForScavengerHuntInZone1)
#	scavengerhunt.hideBasketAndStuffAttachedToIt()
	print "waiting for the species hunt end event, or for a timer to run out"
#	yield viztask.waitAny([viztask.waitEvent(scavengerhunt.ZONE1_OVER_EVENT), viztask.waitTime(60), skipKey])
	yield viztask.waitAny([viztask.waitTime(35), skipKey])
	print "species hunt is over"
#	leftHandVibrateTimer.setEnabled(False)
#	rightHandVibrateTimer.setEnabled(False)
#	scavengerhunt.endScavengerHunt()
#	yield viztask.waitEvent(scavengerhunt.ZONE1_OVER_EVENT)
#	scavengerhunt.disableGrabber()

	#waiting for the audio to end
	print "waiting for the narration to end"
	yield viztask.waitAny([viztask.waitTime(5), skipKey])

	#healthy zone fading out
#	print "fading out from zone-1 begin"
#	globals_oa.fader.fadeOutTask()
	globals_oa.fader.fadeOut()
#	print "fading out from zone-1 complete"
	
	yield viztask.waitAny([viztask.waitTime(5), skipKey])
	
#####	#**Unhealthy CG zone fades in**
#	globals_oa.terrainZone1.disable(viz.RENDERING)
	globals_oa.terrainZone1.visible(viz.OFF)
	if globals_oa.lhModelFlag is not None: globals_oa.lhModelFlag.visible(viz.OFF)
	if globals_oa.rhModelFlag is not None: globals_oa.rhModelFlag.visible(viz.OFF)
	schooling.hide(fishZone1)
	
#	userPos = globals_oa.user.getPosition()
#	globals_oa.user.setPosition(userPos[0] + globals_oa.zone3_X_offset, userPos[1], userPos[2])
#	globals_oa.user.setPosition(userPos[0], userPos[1], userPos[2])
#	globals_oa.basket.setPosition(globals_oa.basketPosInCGscene3)
#	globals_oa.terrainZone3.setPosition(-60.73, 0.0, 0.0)
#	scavengerhunt.hideBasketAndStuffAttachedToIt()
	
	globals_oa.terrainZone3.visible(viz.ON)
#	worldvizcode.stopEffects()
	worldvizcode.startEffects(globals_oa.terrainZone3)

#	schooling.show(fishZone2)	

#	print "fading into zone-3 begin"
#	globals_oa.fader.fadeInTask()
	globals_oa.fader.fadeIn()
#	print "fading into zone-3 complete"

#####	Observe the changes that have occurred as acidity has increased. Reach out and touch one of the streams of bubbles rising from the sea floor
	globals_oa.CG_SCENE2_1.play()
	print "playing CG_SCENE2_1 now"
#	yield viztask.waitAny([viztask.waitMediaEnd(globals_oa.CG_SCENE2_1), skipKey])

#adding proximity handling for touching the bubbles
	global bubbleVibratorManager
	bubbleVibratorManager = vizproximity.Manager()
	
#	bubbleVibratorManager.setDebug(viz.ON)
	vizact.onkeydown('b', bubbleVibratorManager.setDebug, viz.TOGGLE)

	#adding bounding box sensors around the bubbles
	updateVibrationSensors()
#	vizact.onkeydown('u',updateVibrationSensors)

	#adding boxes around the hands as targets
	global rhandtar, lhandtar
#	rhsphere = vizshape.addSphere(radius = 0.07) 
	rhsphere = vizshape.addBox(size=(0.1,0.1,0.3))
	rhsphere.setParent(globals_oa.rightHand)
	rhsphere.setPosition([0,0,-0.15])
	rhsphere.disable(viz.RENDERING)
#	lhsphere = vizshape.addSphere(radius = 0.07) 
	lhsphere = vizshape.addBox(size=(0.1,0.1,0.3))
	lhsphere.setParent(globals_oa.leftHand)
	lhsphere.setPosition([0,0,-0.15])
	lhsphere.disable(viz.RENDERING)
#	if globals_oa.rhModel is not None:
	rhandtar = vizproximity.Target(rhsphere)#globals_oa.rhModel)
#	if globals_oa.lhModel is not None:
	lhandtar = vizproximity.Target(lhsphere)#globals_oa.lhModel)
	
	bubbleVibratorManager.addTarget(rhandtar)
	bubbleVibratorManager.addTarget(lhandtar)

	bubbleVibratorManager.onEnter(None, vibrateHandInBubbles)
	bubbleVibratorManager.onExit(None, stopVibrationOfHandInBubbles)
	
	print "*********************************** SENSORS ADDED FOR VIBRATING BUBBLES ***********************************"

	yield viztask.waitAny([viztask.waitTime(globals_oa.CG_SCENE2_1.getDuration()), skipKey])
	
#####	**wait until participant touches a stream of bubbles**
#####	** repeat last sentence until they do so**


#####The vents here in Ischia are releasing carbon dioxide, which is making the water more acidic. 
#####You study this part of the reef to predict how human carbon dioxide emissions will affect 
#####our world’s oceans and the species that live within them. 
#####Look at your right hand.
	globals_oa.CG_SCENE2_2.play()
	print "playing CG_SCENE2_2 now"
	
	yield viztask.waitAny([viztask.waitTime(16), skipKey])
	
	if globals_oa.rhViveTracker is not None:
		corrodedRotatingSnail.visible(viz.ON)
		vizact.ontimer2(.004, 50, vibrateRightHand)
		print '***********linking cooroded snail'
		snailLink = viz.link(globals_oa.rhViveTracker, corrodedRotatingSnail)
		snailLink.setOffset([0.0, y_offset, 0.0])
		snailLink.preTrans([0.01, -0.03, -0.13])
		snailLink.preEuler([0, 0, 180])
		snailLink.setMask(viz.LINK_POS)
		spinForever = vizact.spin(0,1,0, 90, dur = viz.FOREVER)
		corrodedRotatingSnail.runAction(spinForever)
	yield viztask.waitTime(10)
	corrodedRotatingSnail.visible(viz.OFF)
	
	yield viztask.waitAny([viztask.waitTime(40), skipKey])
	if bubbleVibratorManager is not None:
		bubbleVibratorManager.clearSensors()
		bubbleVibratorManager.clearTargets()

	if rightHandVibrateTimer is not None: rightHandVibrateTimer.setEnabled(False)
	if leftHandVibrateTimer is not None: leftHandVibrateTimer.setEnabled(False)
	globals_oa.finalTransitionSound.play()
#	yield viztask.waitTime(1)
	bubbleStreams = globals_oa.terrainZone3.getChild('zone2_smaller.OSGB')
	bubbleStreams.setAnimationSpeed(0.1)
	globals_oa.UNDERWATER_AMBIENT.stop()
	yield viztask.waitTime(3)
	globals_oa.FINAL_SCENE.play()
	yield viztask.waitAny([viztask.waitTime(10), skipKey])
	fadeInSphere = vizact.fadeTo(0, time=2)
	fadeOutSphere = vizact.fadeTo(1, time=2)
	def fadingFadeThing():
		yield viztask.waitTime(1)
		globals_oa.fadingSphere.addAction(fadeOutSphere)
		yield viztask.waitActionEnd(globals_oa.fadingSphere, fadeOutSphere)
		globals_oa.terrainZone3.visible(viz.OFF)
		globals_oa.ocean.visible(viz.OFF)
#		globals_oa.terrainZone1.visible(viz.ON)
		globals_oa.globeScene.enable(viz.RENDERING)
		globals_oa.user.setPosition(0.0,-0.05,0.0)
		viz.fogcolor(viz.BLACK)
		viz.fog(0.2)
		viz.clearcolor(viz.BLACK)
		globals_oa.fader.fadeOutTask()
		globals_oa.fader.fadeInTask()
#		yield viztask.waitTime(2)
		yield globals_oa.fadingSphere.addAction(fadeInSphere)
	viztask.schedule(fadingFadeThing)
	globals_oa.fader.fadeOutTask()
Esempio n. 35
0
def addPeople(mapManager):

    ### Add people with random route
    for i in range(0, 50):

        avatar = 'vcc_male.cfg'
        if ((int)(random.random() * 10)) % 2 == 0:
            avatar = 'vcc_female.cfg'

        person = vizfx.addAvatar(avatar)

        pos = [random.randint(20, 200), 2.5, random.randint(80, 120)]

        while mapManager.mapper.matrix[(
                int)(pos[0] * mapManager.mapper.squaresPerMeter -
                     mapManager.offsetX)][(
                         int)(pos[2] * mapManager.mapper.squaresPerMeter -
                              mapManager.offsetY)] == 1:
            pos = [random.randint(20, 200), 2.5, random.randint(80, 120)]

        person.setPosition(pos)

        actions = []
        actions.append(pos)

        for j in range(0, 2):

            nextPos = findNextGoal(pos, random.randint(10, 30), mapManager)

            if pos != nextPos:
                actions.append(vizact.walkTo(nextPos))

            pos = nextPos

        if len(actions) > 1:
            person_seq = vizact.sequence(actions, viz.FOREVER)
            person.runAction(person_seq)
        else:
            print("removed avatar")
            person.remove()

    return

    ### Information
    info1 = vizfx.addAvatar('vcc_male.cfg')
    info1.setPosition([3.62353, 2.55017, -64.36298])
    info1.setEuler([180, 0, 0])
    info1.state(1)

    info2 = vizfx.addAvatar('vcc_female.cfg')
    info2.setPosition([0.07517, 2.55017, -64.61992])
    info2.setEuler([180, 0, 0])
    info2.state(1)

    info3 = vizfx.addAvatar('vcc_male2.cfg')
    info3.setPosition([-2.45477, 2.55017, -64.54278])
    info3.setEuler([180, 0, 0])
    info3.state(1)
    ### Information

    ### Shops
    female1 = vizfx.addAvatar('vcc_female.cfg')
    female1.setPosition([-107.63577, 2.60017, -63.46337])
    female1.setEuler(-90, 0, 0)
    female1.state(1)

    male9 = vizfx.addAvatar('vcc_male2.cfg')
    male9.setPosition([-100.42088, 2.60017, -64.16325])
    male9.setEuler(90, 0, 0)
    male9.state(1)

    female2 = vizfx.addAvatar('vcc_female.cfg')
    female2.setPosition([-80.69553, 2.60017, -46.70128])
    female2.setEuler(-90, 0, 0)
    female2.state(1)

    male17 = vizfx.addAvatar('vcc_male.cfg')
    male17.setPosition([-73.44943, 2.60017, -45.32741])
    male17.setEuler(90, 0, 0)
    male17.state(1)

    female3 = vizfx.addAvatar('vcc_female.cfg')
    female3.setPosition([-53.71975, 2.60017, -45.82802])
    female3.setEuler(-90, 0, 0)
    female3.state(1)

    male18 = vizfx.addAvatar('vcc_male2.cfg')
    male18.setPosition([-46.34661, 2.60017, -46.12560])
    male18.setEuler(90, 0, 0)
    male18.state(1)

    female4 = vizfx.addAvatar('vcc_female.cfg')
    female4.setPosition([-15.02875, 2.60017, -45.91469])
    female4.setEuler(-90, 0, 0)
    female4.state(1)

    male19 = vizfx.addAvatar('vcc_male.cfg')
    male19.setPosition([-8.12945, 2.60017, -45.98362])
    male19.setEuler(90, 0, 0)
    male19.state(1)

    female5 = vizfx.addAvatar('vcc_female.cfg')
    female5.setPosition([15.97678, 2.60017, -46.24681])
    female5.setEuler(-90, 0, 0)
    female5.state(1)

    male20 = vizfx.addAvatar('vcc_male.cfg')
    male20.setPosition([22.90181, 2.60017, -46.19674])
    male20.setEuler(90, 0, 0)
    male20.state(1)

    male21 = vizfx.addAvatar('vcc_male2.cfg')
    male21.setPosition([52.47180, 2.60017, -46.11211])
    male21.setEuler(-90, 0, 0)
    male21.state(1)

    female6 = vizfx.addAvatar('vcc_female.cfg')
    female6.setPosition([59.88219, 2.60017, -46.48273])
    female6.setEuler(90, 0, 0)
    female6.state(1)

    female7 = vizfx.addAvatar('vcc_female.cfg')
    female7.setPosition([94.47379, 2.60017, -45.87137])
    female7.setEuler(-90, 0, 0)
    female7.state(1)

    female8 = vizfx.addAvatar('vcc_female.cfg')
    female8.setPosition([101.72762, 2.60017, -46.35223])
    female8.setEuler(90, 0, 0)
    female8.state(1)

    male21 = vizfx.addAvatar('vcc_male.cfg')
    male21.setPosition([-58.85641, 2.60000, -11.10135])
    male21.setEuler([-180, 0, 0])
    male21.state(1)

    male21 = vizfx.addAvatar('vcc_male2.cfg')
    male21.setPosition([-21.21277, 2.60000, -10.96846])
    male21.setEuler(-180, 0, 0)
    male21.state(1)

    female8 = vizfx.addAvatar('vcc_female.cfg')
    female8.setPosition([-2.55035, 2.60000, -10.95346])
    female8.setEuler(-180, 0, 0)
    female8.state(1)
    ### Shops


### Scene dynamic
RandomWait = vizact.waittime(vizact.randfloat(0,0))

for loc in avatarMove:
	
	if loc == avatarMove[2]:
		RandomWait = vizact.waittime(vizact.randfloat(5,10))
	else:
		RandomWait = vizact.waittime(vizact.randfloat(0,0))
	
	actions.append(vizact.method.playsound('footsteps.wav',viz.LOOP))
	actions.append(vizact.walkTo([loc[0],0,loc[1]],turnSpeed=250.0))
	actions.append(vizact.method.playsound('footsteps.wav',viz.STOP))
	
	actions.append(vizact.turn(loc[2],250.0))
	actions.append(RandomWait)
avatar.addAction(vizact.sequence(actions,viz.FOREVER))

avatar = viz.addAvatar('vcc_male.cfg',pos=[-5.7,-5.2,0.1])
avatar.state(1)


#Create static drop shadow to avatar
shadow_texture = viz.addTexture('shadow.png')
shadow = vizshape.addQuad(parent=avatar,axis=vizshape.AXIS_Y)
shadow.texture(shadow_texture)
shadow.zoffset()
avatarMove = [[5.7,-6.2,300],[5.7,6.5,270],[0,7,0],[-5.7,6.5,70],[-5.7,2.6,70],[-5.7,0,130]]
actions = []
RandomWait = vizact.waittime(vizact.randfloat(0,0))

for loc in avatarMove:
    def __init__(self, participant):

        self.visual_maze_instruktionen = {
            'baseline_start':
            'Zu Beginn wird eine Zusatzmessung aufgenommen.\n'
            'Es geht gleich automatisch weiter...',
            'baseline_standing':
            'Halten Sie Ihre Augen offen und\n'
            'entspannen sich.\n'
            'Mit einem Klick,\n'
            'beginnt die Messung',
            'baseline_thrusting':
            'Halten Sie Ihre Augen offen und\n'
            'tasten wiederholt nach vorne.\n'
            'Mit einem Klick,\n'
            'beginnt die Messung.',
            'baseline_end':
            'Bitte beim Versuchsleiter melden.'
        }

        # call constructor of superclass
        super(VisualMaze, self).__init__(participant)

        #ground = viz.add('tut_ground.wrl')  # Add ground

        # create scene of the experiment
        self.subject_id = participant.id
        self.scene = VisualMazeScene(participant.maze_config, self.subject)
        self.maze = None
        self.light = vizfx.addDirectionalLight(euler=(0, 90, 0),
                                               color=viz.WHITE)
        self.hand_tracker_id = None
        self.arm_tracker_id = None
        self.torso_tracker_id = None

        # permuted list of all 4 trial mazes L Z U S, with 24 subjects 1 permutation cycle is complete
        self.trial_list_all = [['Z', 'L', 'U', 'S'], ['L', 'Z', 'U', 'S'],
                               ['U', 'L', 'Z', 'S'], ['L', 'U', 'Z', 'S'],
                               ['Z', 'U', 'L', 'S'], ['U', 'Z', 'L', 'S'],
                               ['U', 'Z', 'S', 'L'], ['Z', 'U', 'S', 'L'],
                               ['S', 'U', 'Z', 'L'], ['U', 'S', 'Z', 'L'],
                               ['Z', 'S', 'U', 'L'], ['S', 'Z', 'U', 'L'],
                               ['S', 'L', 'U', 'Z'], ['L', 'S', 'U', 'Z'],
                               ['U', 'S', 'L', 'Z'], ['S', 'U', 'L', 'Z'],
                               ['L', 'U', 'S', 'Z'], ['U', 'L', 'S', 'Z'],
                               ['Z', 'L', 'S', 'U'], ['L', 'Z', 'S', 'U'],
                               ['S', 'Z', 'L', 'U'], ['Z', 'S', 'L', 'U'],
                               ['L', 'S', 'Z', 'U'], ['S', 'L', 'Z', 'U']]
        # permuted list of all 3 objects to test in rvd task (G = Global Landmark, L = Local, S = Start) with 24 subjects 4 permutation cycles are complete
        self.rvd_list_all = [['G', 'L', 'S'], ['L', 'G', 'S'], ['S', 'G', 'L'],
                             ['G', 'S', 'L'], ['L', 'S', 'G'], ['S', 'L', 'G'],
                             ['G', 'L', 'S'], ['L', 'G', 'S'], ['S', 'G', 'L'],
                             ['G', 'S', 'L'], ['L', 'S', 'G'], ['S', 'L', 'G'],
                             ['G', 'L', 'S'], ['L', 'G', 'S'], ['S', 'G', 'L'],
                             ['G', 'S', 'L'], ['L', 'S', 'G'], ['S', 'L', 'G'],
                             ['G', 'L', 'S'], ['L', 'G', 'S'], ['S', 'G', 'L'],
                             ['G', 'S', 'L'], ['L', 'S', 'G'], ['S', 'L', 'G']]

        # # keys for video recording
        # vidname = str(participant.id) + '_' + str(participant.control_style) + '.avi'
        # viz.setOption('viz.AVIRecorder.fps','25')
        # viz.setOption('viz.AVIRecorder.maxWidth','1280')
        # viz.setOption('viz.AVIRecorder.maxHeight', '720')
        # vizact.onkeydown('b', viz.window.startRecording, vidname)
        # vizact.onkeydown('e', viz.window.stopRecording)

        # ---- collision event params ---- #
        # objects handling current state of visual maze experiment
        # wall enter and exit collision event callbacks
        self.hand_in_wall = False
        self.head_in_wall = False

        # placeholders for visual feedback functions
        self.feedback_hand = None
        self.feedback_start_time = 0
        self.feedback_duration = 0
        self.new_touch_allowed = True
        self.feedback = vizact.sequence(vizact.waittime(0.5),
                                        vizact.fadeTo(
                                            0, time=.2))  # event is 700 ms
        self.help_sphere = vizshape.addSphere(.1)
        self.help_sphere.color(viz.GREEN)
        self.help_sphere.visible(viz.OFF)

        # ---- Bookkeeping variables for behavioral data collection ---- #
        self.current_maze = None
        self.current_trial_run = None

        # ---- Reward tracking variables ---- #
        self.hand_hits = 0
        self.head_hits = 0
        self.local_landmark_hits = 0
        self.duration = 0
        self.start_return = 0

        # pointing task
        self.pointing_task_on = False

        # RVD task objects
        self.rvd_task_on = False
        self.in_rvd_table = False
        self.rvd_table = vizshape.addCube(1)
        self.rvd_table.alpha(0.3)  # make surface barely visible
        self.rvd_table.visible(viz.OFF)
        self.start_sign = viz.add('resources/start.dae')
        self.start_sign.setScale(.02, .02, .02)
        self.start_sign.visible(viz.OFF)
Esempio n. 38
0
day = viz.add('sky_day.osgb')

# Add avatar sitting on a bench
male = viz.addAvatar('vcc_male2.cfg',pos=(-6.5,0,13.5),euler=(90,0,0))
male.state(6)

# Create pigeon
pigeon_root = viz.addGroup()
pigeon_root.visible(False)
pigeon = viz.addAvatar('pigeon.cfg',parent=pigeon_root)

# Add idle animation
random_walk = vizact.walkTo(pos=[vizact.randfloat(-0.5,0.5),0,vizact.randfloat(-0.5,0.5)])
random_animation = vizact.method.state(vizact.choice([1,3],vizact.RANDOM))
random_wait = vizact.waittime(vizact.randfloat(4.0,8.0))
pigeon_idle = vizact.sequence( random_walk, random_animation, random_wait, viz.FOREVER)
pigeon.runAction(pigeon_idle)

# Adding sound to pigeon
hooting = pigeon.playsound('birds.wav',viz.LOOP)
hooting.pause()

# Create flash screen quad
flash_quad = viz.addTexQuad(parent=viz.ORTHO)
flash_quad.color(viz.WHITE)
flash_quad.alignment(viz.ALIGN_LEFT_BOTTOM)
flash_quad.drawOrder(-10)
flash_quad.blendFunc(viz.GL_ONE,viz.GL_ONE)
flash_quad.visible(False)
viz.link(viz.MainWindow.WindowSize,flash_quad,mask=viz.LINK_SCALE)
Esempio n. 39
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)

Esempio n. 40
0
RandomWait = vizact.waittime(vizact.randfloat(0, 0))

for loc in avatarMove:

    if loc == avatarMove[2]:
        RandomWait = vizact.waittime(vizact.randfloat(5, 10))
    else:
        RandomWait = vizact.waittime(vizact.randfloat(0, 0))

    actions.append(vizact.method.playsound('footsteps.wav', viz.LOOP))
    actions.append(vizact.walkTo([loc[0], 0, loc[1]], turnSpeed=250.0))
    actions.append(vizact.method.playsound('footsteps.wav', viz.STOP))

    actions.append(vizact.turn(loc[2], 250.0))
    actions.append(RandomWait)
avatar.addAction(vizact.sequence(actions, viz.FOREVER))

avatar = viz.addAvatar('vcc_male.cfg', pos=[-5.7, -5.2, 0.1])
avatar.state(1)

#Create static drop shadow to avatar
shadow_texture = viz.addTexture('shadow.png')
shadow = vizshape.addQuad(parent=avatar, axis=vizshape.AXIS_Y)
shadow.texture(shadow_texture)
shadow.zoffset()
avatarMove = [[5.7, -6.2, 300], [5.7, 6.5, 270], [0, 7, 0], [-5.7, 6.5, 70],
              [-5.7, 2.6, 70], [-5.7, 0, 130]]
actions = []
RandomWait = vizact.waittime(vizact.randfloat(0, 0))

for loc in avatarMove:
Esempio n. 41
0
viz.go(viz.FULLSCREEN)


# Setup keyboard/mouse tracker
tracker = vizcam.addWalkNavigate(moveScale=2.0)
tracker.setPosition([0,1.8,0])
viz.link(tracker,viz.MainView)
viz.mouse.setVisible(False)

# Load piazza environment
piazza = viz.addChild('piazza.osgb')
viz.addChild('piazza_animations.osgb')

# Loop fountain sound
#piazza.playsound('fountain.wav',viz.LOOP,node='fountain-sound')

# Swap out sky with animated sky dome
piazza.getChild('pz_skydome').remove()
day = viz.add('sky_day.osgb')
day.renderToBackground()

kobe = viz.add('resources/CC2_m016_hipoly_A1_v2.cfg',pos=(0,0,5),euler=(180,0,0))
kobe.state(32)
head = viz.addFace('avatars/kobe/kobe.vzf')
kobe.setFace(head)

talk = vizact.speak('kobe_speech.wav', threshold = 0, scale = 0.01, sync = True)
sequence = vizact.sequence(talk, vizact.waittime(5), viz.FOREVER)
kobe.addAction(sequence)