def _phone_ring(phone_node): global phone_light global enabled print 'phone will be ringing now' phone_node.playsound(RINGTONE_FILE) # phone_light if phone_light: if not enabled: phone_light.enable() enabled = True else: phone_light.disable() enabled = False else: phone_light = vizfx.addSpotLight(scene=SCENE) pos = phone_node.getPosition() euler = phone_node.getEuler() phone_light.position(pos[0],pos[1],pos[2]) phone_light.setEuler(-euler[0],euler[1],euler[2]) phone_light.direction(1,1,0) phone_light.spread(10) phone_light.intensity(2) phone_light.spotexponent(1) viz.link(phone_light, phone_node) phone_light.enable() enabled = True
def addPoliceLights(scene=viz.MainScene): policeLight = vizfx.addSpotLight(scene=scene) policeLight.setEuler(-105, 0, 0) policeLight.color(viz.WHITE) policeLight.emissive(viz.WHITE) policeLight.spotexponent(1) policeLight.quadraticattenuation(1) policeLight.intensity(10) orb = vizshape.addSphere(radius=0.4, flipFaces=True, scene=scene) orb.color(viz.WHITE) orb.emissive(viz.WHITE) orb.alpha(1) viz.link(policeLight, orb) return policeLight
female.setPosition([4,0,3]) female.setEuler(180,0,0) female.state(4) def react(): male.state(2) wait = vizact.waittime(3) scratchAndShrug = vizact.sequence(wait, vizact.animation(5),vizact.animation(7)) male.add(scratchAndShrug) def makeMove(): walk_over = vizact.walkTo([-.5,0,-2.2]) yield viztask.addAction( female, walk_over ) female.addAction(vizact.animation(2)) wait = vizact.waittime(3) yield male.addAction(wait) react() vizact.onkeydown(' ', viztask.schedule, makeMove) viz.MainView.setPosition([0,2,-5.5]) #viz.MainView.setEuler([0, 50, 0]) teapot = model.getChild('Teapot001') person = model.getChild('person') spinAction = vizact.spin(0,1,0,90,viz.FOREVER) slowSpinAction = vizact.spin(0,1,0,45,viz.FOREVER) light1 = vizfx.addDirectionalLight(euler=(0,90,0), color=viz.WHITE) light2 = vizfx.addSpotLight(euler=(0,90,0), color = viz.BLUE, spread=45, pos = [0,4,0])
def makeSiren(scene=viz.MainScene): siren = vizfx.addSpotLight(scene=scene) siren.quadraticattenuation(1) siren.intensity(5) return siren
sky=viz.addChild('sky_day.osgb') sun=vizfx.addDirectionalLight() sun.setScale(500,500,500) sun.color(5.0,5.0,5) sun.setEuler(90,0,0) sky.setPosition(500,0,500) sky.setScale(10,10,10) ''' # Setup keyboard/mouse tracker tracker = vizcam.addWalkNavigate(moveScale=2.0) tracker.setPosition([0,1.8,0]) viz.link(tracker,viz.MainView) viz.mouse.setVisible(True) ''' # Add a yellow spot light light1 = vizfx.addSpotLight(euler=(0,45,0), pos=(0,3,0), color=viz.YELLOW) light2 = vizfx.addSpotLight(euler=(0,45,0), pos=(40,3,30), color=viz.YELLOW) # Add a white directional light pointing down light = vizfx.addDirectionalLight(euler=(0,90,0), color=viz.WHITE) TOWN1 = viz.addChild('full_SCEEN1.dae') TOWN1.setPosition(0,0.7,0) ####################placing benches around################## bench1= viz.addChild('bench.dae') bench1.setScale(2,2,2) bench1.setPosition(4,0,68) bench1.setEuler(170,0,0) bench2= viz.addChild('bench.dae') bench2.setScale(2,2,2)