当前位置: 首页>>代码示例>>Python>>正文


Python vizact.onkeydown函数代码示例

本文整理汇总了Python中vizact.onkeydown函数的典型用法代码示例。如果您正苦于以下问题:Python onkeydown函数的具体用法?Python onkeydown怎么用?Python onkeydown使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了onkeydown函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup_mocap

    def setup_mocap(self, motion):
        self.mocap = vrlab.Phasespace('192.168.1.230', postprocess=True)
        self.mocap.start_thread()

        left_finger_id = None
        right_finger_id = None
        if motion == 'suit':
            self.head = self.mocap.track_rigid(6, center_markers=(3, 5))
            self.motion = self.mocap.track_points(range(6, 50))
            left_finger_id = 25
            right_finger_id = 13
        elif motion == 'glove':
            self.head = self.mocap.track_rigid([0, 2, 4, 6, 8, 10], [4, 8])
            self.motion = self.mocap.track_points([38, 40, 42, 44])
            left_finger_id = 44
            right_finger_id = 0
        else:
            assert False, 'unknown motion source "{}"'.format(motion)

        self.head.link_pose(viz.MainView)
        vizact.onkeydown('r', self.head.reset)

        if left_finger_id:
            self.motion.link_marker(left_finger_id, self.left_finger)
        if right_finger_id:
            self.motion.link_marker(right_finger_id, self.right_finger)
开发者ID:EmbodiedCognition,项目名称:tracing-experiment,代码行数:26,代码来源:main.py

示例2: main

def main():
	global masterTimerG, recordingTimer
	setUp()
	masterTimerG = vizact.ontimer(0, masterTimer)
	#recordingTimer = vizact.ontimer(0, recordCurrentSubjectStatus)
	
	if not KEYBOARD_NAVIGATE:
		addKeyPresses()
	else:
		# Setup keyboard/mouse tracker
		tracker = vizcam.addWalkNavigate(moveScale=10.0)
		tracker.setPosition([0,1.8,0])
		viz.link(tracker,viz.MainView)
		viz.mouse.setVisible(False)
		def printLocation():
			print viz.MainView.getPosition(), viz.MainView.getEuler()
		vizact.onkeydown('p', printLocation)
	
	
	#Add Wiimote support
#	wii = viz.add('wiimote.dle')
#	#Connect to first available wiimote
#	wiimote = wii.addWiimote()
#	wiimote.led = wii.LED_4
#	#Add button functions
#	vizact.onsensordown(wiimote,wii.BUTTON_A,TurnFlyingOn)
#	vizact.onsensordown(wiimote,wii.BUTTON_B,TurnFlyingOff)
#	vizact.onsensordown(wiimote,wii.BUTTON_1,endChildHappy)
#	
	#Hacky bug fix below, I apologize -Mark
	if not FLYING_F and YOKE_F:
		viztask.schedule(fixStartHeliPos) 
开发者ID:vhilab,项目名称:Demos,代码行数:32,代码来源:Flying_Demo_2015.py

示例3: __init__

	def __init__(self):

		self.canvas = viz.addGUICanvas(scene = viz.Scene2)
		canvas = self.canvas
		
		
		# Compatibility for all display types
		canvas.setCursorSize([25,25])
		canvas.setCursorPosition([0,0])
	
		#init keybindings
		self.keybindings = []
		self.keybindings.append(vizact.onkeydown(viz.KEY_RETURN, self.nextMenu))
		self.keybindings.append(vizact.onkeydown(viz.KEY_ESCAPE, self.exitGame))
		
		#init menus
		self.mainMenu		= MainMenu(canvas, self)
		self.modeMenu		= ModeMenu(canvas, self)
		self.layerMenu		= LayerMenu(canvas, self)
		self.loadingScreen 	= LoadingScreen()
		self.inGameMenu		= InGameMenu(canvas, self)
		
		#stating menu display path
		self.menuOrder = [self.mainMenu, self.modeMenu, self.layerMenu, self.inGameMenu]
		
		self.activeMenu = self.mainMenu
开发者ID:bmj8778,项目名称:sterescopicTableTop,代码行数:26,代码来源:menu.py

示例4: __init__

	def __init__(self,use_keyboard = True, desktop_mode = False):
		
		caveapp.CaveApplication.__init__(self,desktop_mode) #call constructor of super class, you have to do this explicitly in Python		
		#self.wand = vizshape.addAxes() #load axis model to represent the wand (WALL FFS!)
		
		# Add skybox
		sky = viz.add(viz.ENVIRONMENT_MAP,'alien/jajalien1.jpg')
		skybox = viz.add('skydome.dlc')
		skybox.texture(sky)
		
		# First light added seems to be ignored....
		# Add lighting
		dummy = viz.addLight()
		light = viz.addLight()
		light.position(0, 0, 0)
		light.color([0.8, 1, 0.8])
		
		self.use_keyboard = use_keyboard #store if we want to use the keyboard
		#self.time = 0.0 #note that to 0.0 is important because it is a double precision floating point number
		
		self.speed = 400.0 #--four-- meters per second
		originTracker = self.cavelib.getOriginTracker()
		#originTracker.setPosition([-100,100,0],viz.REL_LOCAL)
		self.returnToStart()
		self.yaw = 90
		self.startSet=0
		self.joystickpressed=0
		
		vizact.onkeydown(' ', viz.setDebugSound3D, viz.TOGGLE)
开发者ID:ArjanBroos,项目名称:Inter,代码行数:29,代码来源:MainTimTest_stages.py

示例5: togRecording

def togRecording():
	recSound.play()
	if(file != None):
		newthread = viz.director(hf_playback.saveUpdateLoop, avatar, file)
		vizact.onkeydown(viz.KEY_ESCAPE, hf_playback.cleanup, file, newthread)
	touchcube.wakeTouchCubes()
	hf_playback.toggleRecording()
开发者ID:vhilab,项目名称:thirdArm,代码行数:7,代码来源:MirrorTouchCubes3.py

示例6: load

def load(sceneRef=viz.MainScene):
  global SCENE
  SCENE = sceneRef # TODO: Add scene params to all viz.add calls, etc in this module and submodules
  
  #Add audio
  global introAudio
  introAudio = viz.addAudio('Audio/Bus Scene/BusIntroduction.wav')
  global ambientAudio
  ambientAudio = viz.addAudio('Audio/Bus Scene/BusAmbientNoise.wav')
  
  
  #add bus
  BUS_OBJ_SCALE = .0365
  BUS_OSGB_SCALE = 35
  curscale = BUS_OSGB_SCALE
  bus = vizfx.addChild('bus_obj/Bus_Final_Scene1.OSGB', scene=SCENE)
  bus.setScale([curscale]*3)
  #bus.emissive(1,1,1) # Makes it look like daytime

  # add homeless avatars
  global avatars
  avatars = avatarconfig.initAvatars(SCENE)
  
  # create reference to backpack and thief for fading. The .fade attribute = True means that the
  # object should fade if not in view.
  pack_objs = []
  pack = bus.getChild('pack')
  straps = bus.getChild('backpackstraps')
  
  avatars[1].fade = False
  pack.fade = True
  straps.fade = True
  
  pack_objs.append(avatars[1])
  pack_objs.append(pack)
  pack_objs.append(straps)
  
  viz.MainView.getHeadLight().disable()
  
  global controlAvOnKeyPress, controlViewOnKeyPress
  controlAvOnKeyPress = vizact.onkeydown('c', keyboardcontrol.control, avatars[0])
  controlViewOnKeyPress = vizact.onkeydown('v', keyboardcontrol.control, MainView)

  if RIFT:
    creepySeatChanging = CreepySeatChanging.init(avatars[0], pack_objs, introAudio, vfov=VFOV_RIFT, hfov=HFOV_RIFT)
  else:
    creepySeatChanging = CreepySeatChanging.init(avatars[0], pack_objs, introAudio, vfov=VFOV_DEFAULT)
  
  CreepySeatChanging.disable()
  
  #BusLighting.addLighting(SCENE)
  BusLighting.addStreetlights(SCENE)
  global toggleBusLightsOnKeyPress
  toggleBusLightsOnKeyPress = vizact.onkeydown('z', BusLighting.toggleBusLighting)
  
  global dc
  dc = DataCollector(filePrefix='Data/CreepySeatTrackingData_Participant', fileSuffix='.csv')
  dc.addMainviewTracker()
  dc.startCollecting()
开发者ID:vhilab,项目名称:homelessness-study,代码行数:59,代码来源:busSceneDesktop.py

示例7: __init__

	def __init__(self):
		#init canvas and create themes for the test panel
		self.canvas = viz.addGUICanvas(align = viz.ALIGN_CENTER_CENTER)
		self.canvas.setPosition(0,0,0)
		viz.mouse.setVisible(False)
		self.name = 'test'
		self._theme = viz.Theme()
		self._theme.borderColor = (0.1,0.1,0.1,1)
		self._theme.backColor = (0.4,0.4,0.4,1)
		self._theme.lightBackColor = (0.6,0.6,0.6,1)
		self._theme.darkBackColor = (0.2,0.2,0.2,1)
		self._theme.highBackColor = (0.2,0.2,0.2,1)
		self._theme.textColor = (1,1,1,1)
		self._theme.highTextColor = (1,1,1,1)
		
		#initialize test panel
		vizdlg.Panel.__init__(self, parent = self.canvas, theme = self._theme, align = viz.ALIGN_CENTER_TOP, fontSize = 15)
		self.visible(viz.OFF)
		self.setScale(*[i*config.menuScale[self.name] for i in [1,1,1]])
		self.alpha(0.6)
		
#		#title
		title = vizdlg.TitleBar('INSTRUCTIONS')
		self.addItem(title, align = viz.ALIGN_CENTER_TOP)
		
		#bones to be snapped. source snapped to target.
		source = 'a'*20
		self.sourceText = viz.addTextbox(parent = self.canvas)
		self.sourceText.setLength(1.5)
		target = 'a'*20
		self.targetText = viz.addTextbox(parent = self.canvas)
		self.targetText.setLength(1.5)
		
		#instructions 
		self.Instruct1 = self.addItem(viz.addText('Snap the: ', parent = self.canvas), align = viz.ALIGN_CENTER_TOP)
		self.sourceCommand = self.addItem(self.sourceText, align = viz.ALIGN_CENTER_TOP)
		self.Instruct2 = self.addItem(viz.addText('To the: ', parent = self.canvas), align = viz.ALIGN_CENTER_TOP)
		self.targetCommand = self.addItem(self.targetText, align = viz.ALIGN_CENTER_TOP)
		
		#render canvas
		
		if config.dispMode == config.DisplayMode.monitor:
			self.canvas.billboard(viz.BILLBOARD_YAXIS)
			self.canvas.setPosition(-2,0,0)
			self.canvas.setBackdrop(viz.ALIGN_CENTER_TOP)
			

		if config.dispMode == config.DisplayMode.oculus:

			bb = self.canvas.getBoundingBox()
			self.canvas.setRenderWorldOverlay([bb.width*1, bb.height*1], fov = bb.height, distance = 0.4)
			self.canvas.setPosition(0,0.05,0)
			self.canvasViewPos = self.canvas.getPosition()
			self.canvas.setEuler(0,15,0)
			self.canvas.setPosition(0, -5, 0)
			self.canvasHidePos = self.canvas.getPosition()
			viztask.schedule(self.updatePanelPos())
			
		vizact.onkeydown(viz.KEY_ESCAPE, self.toggle)
开发者ID:erikmessier,项目名称:anatomy-puzzle,代码行数:59,代码来源:view.py

示例8: __init__

 def __init__(self, targetNode):
     self.control(targetNode)
     vizact.ontimer(0, self.UpdateView)
     vizact.onkeydown("t", self.resetPitch)
     vizact.onkeydown("y", self.slower)
     vizact.onkeydown("u", self.faster)
     vizact.onkeydown("o", self.printEuler)
     vizact.onkeydown("p", self.printPos)
开发者ID:vhilab,项目名称:Ocean-Acidification,代码行数:8,代码来源:vhil_devkit_Vive.py

示例9: __init__

 def __init__(self, targetNode):
   self.control(targetNode)
   vizact.ontimer(0,self.UpdateView)
   vizact.onkeydown('t', self.resetPitch)
   vizact.onkeydown('y', self.slower)
   vizact.onkeydown('u', self.faster)
   vizact.onkeydown('o', self.printEuler)
   vizact.onkeydown('p', self.printPos)
开发者ID:vhilab,项目名称:VHIL-Module-Library,代码行数:8,代码来源:vhil_devkit.py

示例10: init

def init():
  vhilGo(rift = RIFT)#, mode=viz.FULLSCREEN)
#  viz.window.setFullscreenMonitor(1) # For Lucas's computer - comment out if you want
  
  keyboardcontrol.control(viz.MainView)
  
  for Scene in SCENE_REFS:
    Scene.load(sceneRef=SCENE_REFS[Scene])
    vizact.onkeydown(SCENE_KEYCHAR[Scene], scheduleSwitchScene, Scene)
开发者ID:vhilab,项目名称:homelessness-study,代码行数:9,代码来源:MAIN_HomelessStudy.py

示例11: __init__

    def __init__(self, IDsToSelect):
        self.selectableIDs = IDsToSelect
        self.crosshair, self.crosshairLink = AimCenterScreen.addAimer()
        vizact.onkeydown("m", self.focusCrosshair)

        self.selected = None
        self.timer = vizact.ontimer(0.1, self.focus)

        self.disable()
开发者ID:vhilab,项目名称:homelessness-study,代码行数:9,代码来源:AvatarSelection_backup.py

示例12: main

def main():
	vizact.ontimer(0,updateJoy)
	vizact.ontimer(0, updateEuler)
	#vizact.ontimer(0, shoot)
	FileReader()
	initializeObjectFiles()
	initializeLocations()
	getCurrentTestingLocationOrder()
	vizact.ontimer(0.1, update)
	vizact.onkeydown(' ', statusUpdate)
开发者ID:rhodesvr,项目名称:myo-march,代码行数:10,代码来源:joysitck.py

示例13: main

def main():
    ### Configuration parameters
    # moved to config.py

    ### Game startup
    # overwrite escape key
    viz.setOption("viz.default_key.quit", "0")

    # Physics
    viz.phys.enable()
    # viz.phys.setGravity(0,0,0)

    # Initialize pointer tool
    # Unused?
    glove = viz.addChild(".\\dataset\\Hand\\handPoint_Reduced.ply")
    glove.disable([viz.PHYSICS, viz.DYNAMICS])

    glovePhys = glove.collideSphere()
    glove.setPosition([0, 1, 0])
    glove.setScale([1, 1, 1])

    # Initialize environment this will load the coliseum and sky
    sky = viz.addChild("sky_day.osgb")
    sky.collideMesh()
    sky.disable(viz.DYNAMICS)
    init.loadTemple()

    # Initialize pointer controls
    device = init.pointerInput(config.pointerMode, glove, sky)

    # Initialize display
    puzzle.model.display = init.DisplayInstance(config.dispMode, config.camMode, device, glove)
    # init.display(config.dispMode)

    # Initialize camera controls
    # init.cameraInput(config.camMode,config.dispMode, device, glove)

    # Launch menu system
    menu.init()
    puzzle.model.pointer = glove
    puzzle.model.pointer.setScale(0.015, 0.015, 0.015)
    puzzle.model.pointer.setEuler(0, -115, 0)

    # Override default escape key map to call main menu
    vizact.onkeydown(viz.KEY_ESCAPE, menu.toggle)

    # 	# Record moviefilms
    # 	viz.setOption('viz.AVIRecorder.maxWidth', '1280')
    # 	viz.setOption('viz.AVIRecorder.maxHeight', '720')
    # 	vizact.onkeydown(viz.KEY_F11, viz.window.startRecording, 'D:\\recording.avi')
    # 	vizact.onkeydown(viz.KEY_F12, viz.window.stopRecording)

    # Stuff to run on program termination
    vizact.onexit(puzzle.controller.end)
开发者ID:erikmessier,项目名称:anatomy-puzzle,代码行数:54,代码来源:main.py

示例14: __init__

	def __init__(self):		
		super(self.__class__,self).__init__()
		
		# Link navigation node to main view
#		self.NODE = viz.addGroup()
#		self.VIEW_LINK = viz.link(self.NODE, self.VIEW)
		
		# --add oculus as HMD
		self.hmd = oculus.Rift()
		
		if not self.hmd.getSensor():
			viz.logError('** ERROR: Failed to detect Oculus Rift')
		else:
			# Reset HMD orientation
			self.hmd.getSensor().reset()

			# Setup navigation node and link to main view
#			self.NODE = viz.addGroup()
#			self.VIEW_LINK = viz.link(self.NODE, viz.VIEW)
			self.VIEW_LINK.preMultLinkable(self.hmd.getSensor())

			# --Apply user profile eye height to view
			profile = self.hmd.getProfile()
			if profile:
				self.VIEW_LINK.setOffset([0,profile.eyeHeight,0])
				viz.logNotice('Oculus profile name:', profile.name)
				viz.logNotice('Oculus IPD:', profile.ipd)
				viz.logNotice('Oculus player height:', profile.playerHeight)
				viz.logNotice('Oculus eye height:', profile.eyeHeight)
			else: 
				self.VIEW_LINK.setOffset([0,self.EYE_HEIGHT,0])
				
			# Check if HMD supports position tracking
			supportPositionTracking = self.hmd.getSensor().getSrcMask() & viz.LINK_POS
			if supportPositionTracking:
				
				# Add camera bounds model
				self.camera_bounds = self.hmd.addCameraBounds()
				self.camera_bounds.visible(False)

				# Change color of bounds to reflect whether position was tracked
				def checkPositionTracked():
					if self.hmd.getSensor().getStatus() & oculus.STATUS_POSITION_TRACKED:
						self.camera_bounds.color(viz.GREEN)
					else:
						self.camera_bounds.color(viz.RED)
				vizact.onupdate(0, checkPositionTracked)

				# Setup camera bounds toggle key
				def toggleBounds():
					self.camera_bounds.visible(viz.TOGGLE)
				vizact.onkeydown(self.KEYS['camera'], toggleBounds)
开发者ID:justlim77,项目名称:TrussBridgeBuilder,代码行数:52,代码来源:navigation.py

示例15: enable

def enable():
	global car, call_screen, SCENE
	viz.MainWindow.setScene(SCENE)
	reset()
	vizact.onkeydown('r', reset)
	#PhoneRadio.test(SCENE, car, call_screen)
	PhoneRadio.enable(SCENE, car, call_screen)
	
	#wait for keypress 1 to start object finding portion
	viz.callback(PhoneRadio.INTRO_OVER_EVENT, PosessionHunting.enable)
	
	#waits for last object to be found, and then schedules police narrative
	viz.callback(PosessionHunting.FINDING_TASK_OVER_EVENT, police.enable)
开发者ID:vhilab,项目名称:homelessness-study,代码行数:13,代码来源:CarScene.py


注:本文中的vizact.onkeydown函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。