#------------------------------------------------ #------------Avatar creation--------------------- avatars = [] for x in range(0, 3): a = viz.addChild('vcc_male.cfg') a.state(1) a.setPosition(random.choice(positions)) avatars.append(a) #------------------------------------------------ for a in avatars: avaTarget = vizproximity.Target(a) # need to add sensors to each of the avatars avatarSensor = vizproximity.Sensor(vizproximity.Box([2, 4, 2]), source=a) avatarManager.addSensor(avatarSensor) manager.addTarget(avaTarget) avatarManager.addTarget(target) for s in sensorList: manager.addSensor(s) #------------------------------------------------ #-----------Random movement of avatars----------- def moveAvatars(): for a in avatars: walk = vizact.walkTo(random.choice(positions)) a.runAction(walk)
import vizinfo import vizproximity env = viz.addEnvironmentMap('sky.jpg') viz.clearcolor(viz.SKYBLUE) viz.mouse.setScale(100, 2) # 100x movement speed, 2x rotation speed viz.move([10, 10, 10]) # i think this sets the starting position to 10,10,10 karnak = viz.addChild('KarnakFBX.fbx') viz.setMultiSample(4) viz.go() vizshape.addAxes() info = vizinfo.InfoPanel("Let get started") sensorAvatar1 = vizproximity.Sensor(vizproximity.Box( [3170, 160, 3051], center=[3123.10181, 160.43307, -7414.27441]), source=karnak) sensorAvatar2 = vizproximity.Sensor(vizproximity.Box( [749, 741, 1439], center=[11489.54081, 447.63779, -2581.69801]), source=karnak) sensorAvatar3 = vizproximity.Sensor(vizproximity.Box( [1400, 422, 1400], center=[3854.15869, 375.59055, -1661.75696]), source=karnak) sensorAvatar4 = vizproximity.Sensor(vizproximity.Box( [8555, 811, 6949], center=[6046.80322, 334.64569, 189.79089]), source=karnak) target = vizproximity.Target(viz.MainView) manager = vizproximity.Manager() manager.addSensor(sensorAvatar1)
import vizinfo import vizproximity env = viz.addEnvironmentMap('sky.jpg') viz.clearcolor(viz.SKYBLUE) viz.mouse.setScale(100, 2) # 100x movement speed, 2x rotation speed viz.move([10, 10, 10]) # i think this sets the starting position to 10,10,10 karnak = viz.addChild('KarnakFBX.fbx') viz.setMultiSample(4) viz.go() vizshape.addAxes() info = vizinfo.InfoPanel("Let get started") sensorAvatar1 = vizproximity.Sensor(vizproximity.Box( [3170, 160, 3051], center=[3123.10181, 160.43307, -7414.27441]), source=karnak) sensorAvatar2 = vizproximity.Sensor(vizproximity.Box( [749, 741, 1439], center=[11489.54081, 447.63779, -2581.69801]), source=karnak) sensorAvatar3 = vizproximity.Sensor(vizproximity.Box( [1400, 422, 1400], center=[3854.15869, 375.59055, -1661.75696]), source=karnak) sensorAvatar4 = vizproximity.Sensor(vizproximity.Box( [8555, 811, 6949], center=[6046.80322, 334.64569, 189.79089]), source=karnak) # Michael's additions TempleOfKhonsCenter = [-6856.85400, 80.60259, -5399.07031] TempleOfKhonsBox = [2189.75, 101, 2746] sensorAvatarTempleOfKhons = vizproximity.Sensor(vizproximity.Box(
scene1.hint(viz.ALLOW_NPOT_TEXTURE_HINT) scene1.disable(0x3000) #Disable clip plane on model waterPlane = vizshape.addPlane(size=[400, 400], pos=[0, 0.2, 0]) obj_vis.append(scene1) obj_vis.append(waterPlane) sky = viz.addChild('sky_day.osgb') obj_vis.append(sky) #bellSensorLocation = viz.addGroup(pos=[0.74121, 0.61385, -74.72057]) #bellSensor = vizproximity.Sensor(vizproximity.Box(size=[6,10,6]),source=bellSensorLocation) #bellLocation = viz.addGroup(pos=[0.90712, 4.80442, -91.77573]) #bell_sound = bellLocation.playsound('bells.wav',flag=viz.PAUSE) stoneSensorLocation = viz.addGroup(pos=[0, 3.5, -90]) stoneSensor = vizproximity.Sensor(vizproximity.Box(size=[2, 3, 2]), source=stoneSensorLocation) from vizfx.postprocess.blur import GaussianBlurEffect from vizfx.postprocess.composite import BlendEffect # Create post process effect for blending to blur effect blur_effect = BlendEffect(None, GaussianBlurEffect(blurRadius=20), blend=0.0) blur_effect.setEnabled(False) vizfx.postprocess.addEffect(blur_effect) def BlurTask(): blur_effect.setBlend(0.0) blur_effect.setEnabled(True) yield viztask.waitCall(blur_effect.setBlend, vizact.mix(0.0, 1.0, time=3.0))
#Have it grow when text reaches its boundary. textbox1.overflow(viz.OVERFLOW_GROW) textbox1.message('you are at the gas station') textbox1.add(fadeInOut) vizact.onmousedown(viz.MOUSEBUTTON_LEFT, landmark) vizact.onkeydown('p', landmark) ###############################sensor visible############################# #Create sensors for destinations bomb_in_trashcan1 = vizproximity.Sensor(vizproximity.Box([4, 5, 5], center=[0, 2.5, 0]), source=bomb_in_trashcan) bomb_in_school1 = vizproximity.Sensor(vizproximity.Box([5, 4, 4], center=[0, 1.7, 0]), source=bomb_in_school) #Add main viewpoint as proximity target target = vizproximity.Target(viz.MainView) #Create proximity manager manager1 = vizproximity.Manager() #Add destination sensors to manager manager1.addSensor(bomb_in_trashcan1) manager1.addSensor(bomb_in_school1)
stimuli) + ',' + str(trialNo) + ',' + str(viz.tick()) + ',' + str( view.getPosition()).strip('[]') + ',' + str( view.getEuler()).strip('[]') + '\n' record.write(data) yield viztask.waitTime(1 / 75) # Set up a calibration at the beginning of each trial manager_cali = vizproximity.Manager() # First create a transparent ball eyepatch = viz.addTexQuad(parent=viz.HEAD, color=viz.CYAN, size=1) eyepatch.setPosition([0, 0, 5], viz.ABS_PARENT) eyepatch.alpha(0.5) eyepatch.visible(viz.OFF) # Set up sensor sensor = vizproximity.Sensor(vizproximity.Box(size=[0.4, 0.4, 2]), source=Cross) # Set up target target_cali = vizproximity.Target(eyepatch) # Add sensor and target manager_cali.addSensor(sensor) manager_cali.addTarget(target_cali) # Set up the information panel info = hmd.addMessagePanel('', pos=(0, 0, 3)) info.visible(viz.OFF) # Set up the staircase # Multiple staircases exp_conditions = [ {
boxList = [] #~ stores boxes massMakeBoxes(boxList) width = float(vizinput.input('Input the length from soulder to shoulder: \n ')) hieght = float(vizinput.input('Input the length from shoulder to foot: \n ')) length = float(vizinput.input('Input the length from soulder to arm: \n ')) # coordinates for right hand front # Adjust for centering the boxs x = width / 2 - 0.05 y = hieght - 0.05 z = length - 0.05 boxList[0].setPosition(x, y, z) rightFrontSensor = vizproximity.Sensor(vizproximity.Box([bSize, bSize, bSize]), boxList[0]) manager.addSensor(rightFrontSensor) boxList[0].visible(viz.OFF) # coordinates for left hand front boxList[1].setPosition(-x, y, z) leftFrontSensor = vizproximity.Sensor(vizproximity.Box([bSize, bSize, bSize]), boxList[1]) manager.addSensor(leftFrontSensor) boxList[1].visible(viz.OFF) # coordinates for start sensor right hand boxList[6].setPosition(x, hieght - length, 0) rightHandStart = vizproximity.Sensor(vizproximity.Box([bSize, bSize, bSize]),
def reactTime(): clicktime = viz.tick() sub_rt.write(',' + str(clicktime)) vizact.onkeydown('.', reactTime) SPpos = ([0, 0, 0], [0, 1.5, 0], [0, 1.5, distance]) # Set up proximity sensors manager = vizproximity.Manager() target = vizproximity.Target(view) manager.addTarget(target) sensor_Target = vizproximity.Sensor(vizproximity.Box([0.6, 6, 0.1]), source=Target) manager.addSensor(sensor_Target) # Refresh dots def refreshing(clouds): index = 0 while True: clouds[index].remove() pos = np.random.uniform(low=-6, high=6, size=(5250 / freq, 3)) pos[:, 1] = pos[:, 1] / 4 pos[:, 2] = pos[:, 2] - 5 viz.startLayer(viz.POINTS) viz.pointSize(2) for n in range(5250 / freq):