• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python viz.callback函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __init__

	def __init__(self):
		viz.callback(viz.COLLIDE_BEGIN_EVENT, onCollide)

		self.node = vizshape.addCube(TouchCube.DEFAULT_SIZE)
		viz.VizNode.__init__(self,self.node.id)
		self.collideBox()
		self.disable(viz.DYNAMICS)
		self.enable(viz.COLLIDE_NOTIFY)
		#BL:start
		if some_global_variables.PPT1:
			if TouchCube.activateSound == None:
				TouchCube.activateSound = self.playsound(PATH_TO_STUFF + "./Resources/Misc/tcActivate.wav", viz.STOP, volume=0.1)
			if TouchCube.bingSound == None:
				# Bing
				TouchCube.bingSound = self.playsound(PATH_TO_STUFF + "./Resources/Misc/bingCropped.wav", viz.STOP, volume = 0.1)
		else:
			if TouchCube.activateSound == None:
				TouchCube.activateSound = self.playsound(PATH_TO_STUFF + "./Resources/Misc/tcActivate_mono.wav", viz.STOP)
			if TouchCube.bingSound == None:
				# Bing
				TouchCube.bingSound = self.playsound(PATH_TO_STUFF + "./Resources/Misc/bingCropped_mono.wav", viz.STOP)
		#BL:end

		self.color = self._changeColor
		self._dimColor = [1,1,1]

		self._isLit = False

		self.disabledTouchers = []
开发者ID:vhilab,项目名称:fiveArms,代码行数:29,代码来源:touchcube.py


示例2: initializeBoatGrabberAndPhysics

def initializeBoatGrabberAndPhysics():
 global grabberTool, ObjectsToGrab, ALL_GRABBED_EVENT
 
 globals_oa.boat.collideMesh() 
 usingPhysics=False
 
 from tools import grabber
 from tools import highlighter
 
 global rhGrabber, lhGrabber
 if rhGrabber is None:
  rhGrabber = grabber.Grabber(usingPhysics=False, usingSprings=False, highlightMode=highlighter.MODE_BOX)
 if lhGrabber is None:
  lhGrabber = grabber.Grabber(usingPhysics=False, usingSprings=False, highlightMode=highlighter.MODE_BOX)
 rhGrabber.setUpdateFunction(rUpdateGrabberOnBoat)
 if globals_oa.rhModel is not None: rhGrabber.setParent(globals_oa.rhModel)
 lhGrabber.setUpdateFunction(lUpdateGrabberOnBoat)
 if globals_oa.lhModel is not None: lhGrabber.setParent(globals_oa.lhModel) 

 for obj in ObjectsToGrab:
   obj.collideBox()   

 rhGrabber.setItems(ObjectsToGrab)
 lhGrabber.setItems(ObjectsToGrab)
 
 viz.callback(grabber.GRAB_EVENT,grabObject)
 viz.callback(grabber.RELEASE_EVENT, releaseObject)
开发者ID:vhilab,项目名称:Ocean-Acidification,代码行数:27,代码来源:MoleculeGrabbingHandTarget.py


示例3: add_periodic

    def add_periodic(self, period, callback):
        '''Call some code periodically while running a task.

        The given `callback` will be called every `period` seconds between the
        firings of the PRE_RUN and POST_RUN events for this task.

        Parameters
        ----------
        period : float
            Number of seconds between successive calls to the `callback`.
        callback : callable (no arguments)
            Call this function every `period` seconds.

        Returns
        -------
        timer_id :
            The Vizard timer ID. Can be used to kill this periodic event.
        '''
        timer_id = 1 + max(self._timers)
        self._timers.append(timer_id)

        viz.callback(self.POST_RUN_EVENT, lambda me: viz.killtimer(timer_id))
        def start(me):
            def clock(t):
                if t == timer_id: callback()
            viz.callback(viz.TIMER_EVENT, clock)
            viz.starttimer(timer_id, period, viz.FOREVER)
        viz.callback(self.PRE_RUN_EVENT, start)

        return timer_id
开发者ID:EmbodiedCognition,项目名称:cube-experiment,代码行数:30,代码来源:task.py


示例4: start

        def start(me):
            def clock(t):
                if t == timer_id:
                    callback()

            viz.callback(viz.TIMER_EVENT, clock)
            viz.starttimer(timer_id, period, viz.FOREVER)
开发者ID:EmbodiedCognition,项目名称:tracing-experiment,代码行数:7,代码来源:task.py


示例5: main

def main():
	global loc_list
	global active_location
	loc_list = []
	
	mainSceneWindow = None
	cameraWindow = None
	cameraWindowView = None
	cam = None
	pause_screen = None
	nunchuck_disconnect_screen = None
	message_screen = None
	wiimote = None
	nunchuck_wiimote = None
	should_it_run = None
	
	mainSceneWindow, cameraWindow, cameraWindowView, cam, pause_screen, nunchuck_disconnect_screen, message_screen, wiimote, nunchuck_wiimote, should_it_run = init_settings(mainSceneWindow, cameraWindow, cameraWindowView, cam, pause_screen, nunchuck_disconnect_screen, message_screen, wiimote, nunchuck_wiimote, should_it_run)
	
	vizact.ontimer(0, moveCamera, nunchuck_wiimote, should_it_run)
	viz.callback(wii.EXT_CONNECT_EVENT,onConnect)
	viz.callback(wii.EXT_DISCONNECT_EVENT,onDisconnect)
	
	initializer(loc_list)
	arMarkerLoader(cam)
	wiimoteInitializer(wiimote, nunchuck_wiimote, should_it_run, message_screen)
	
	viz.go() # Inicia VIZ
	
	for item in loc_list:
		if item.space_name == "piazza.osgb":
			active_location = item
			item.addLocation()
开发者ID:luion,项目名称:virtual-ar-museum,代码行数:32,代码来源:universe.py


示例6: __init__

	def __init__(self):
		viz.callback(viz.COLLIDE_BEGIN_EVENT, onCollide)

		self.node = vizshape.addCube(TouchCube.DEFAULT_SIZE)
		viz.VizNode.__init__(self,self.node.id)
		self.collideBox()
		self.disable(viz.DYNAMICS)
		self.enable(viz.COLLIDE_NOTIFY)
		#BL:start
		if USING_VIZSONIC:
			if TouchCube.activateSound == None:
				TouchCube.activateSound = self.playsound("./Resources/Misc/tcActivate.wav", viz.STOP, volume=0.1)
			if TouchCube.bingSound == None:
				# Bing
				TouchCube.bingSound = self.playsound("./Resources/Misc/bingCropped.wav", viz.STOP, volume = 0.1)
		else:
			print "skipping those errors!"
			if TouchCube.activateSound == None:
				TouchCube.activateSound = self.playsound("./Resources/Misc/tcActivate_mono.wav", viz.STOP)
			if TouchCube.bingSound == None:
				# Bing
				TouchCube.bingSound = self.playsound("./Resources/Misc/bingCropped_mono.wav", viz.STOP)
		#BL:end

		self.color = self._changeColor
		self._dimColor = [1,1,1]

		self._isLit = False

		self.disabledTouchers = []
开发者ID:vhilab,项目名称:thirdArm,代码行数:30,代码来源:touchcube.py


示例7: creepilyMoveCloser

def creepilyMoveCloser(node):
	global introAudio1, introAudio2
	global comeForward, firstSeatPosition, seatQueue
	global PID
	dout = DataOutputHelper(PID)
	comeForward = seatQueue[-2]
	firstSeatPosition = seatQueue[0]
	node.setPosition(firstSeatPosition)
	
	yield viztask.waitMediaEnd(introAudio1)
	
	introAudio2.play()
	
	# We want the participant to have a minute after the audio ends
	viz.callback(viz.MEDIA_EVENT,onAudioEnd)
	dout.timestamp(dout.busFile, 'Initial audio ended')
	
	yield viztask.waitMediaEnd(introAudio2)

	yield viztask.waitTime(.1) # Pause necessary for NodeViewDetection to get necessary info about node
	nvd = DetectWhetherInView.NodeViewDetection(node)
	FadeObject.beginFading()
	
	moveAsUsual = False
	getCloserBeforeBackAway = True
	
	while getCloserBeforeBackAway:
		node.setPosition(firstSeatPosition)
		yield waitTilNodeAndDestOutsideView(nvd, firstSeatPosition)
		yield waitTilNodeInsideView(nvd)
		node.setPosition(comeForward)
		yield creepilyMakeEyeContact(node, comeForward, dout)
		yield moveBackToFirstSeat(node, seatQueue)
		if abs(node.getPosition()[0] - firstSeatPosition[0]) < 0.1:
			getCloserBeforeBackAway = False
			moveAsUsual = True
	
	print 'waiting til node inside view...'
	yield waitTilNodeInsideView(nvd)	
	while moveAsUsual:
		print 'waiting until node and dest outside view...'
		nextPosition = seatQueue[1] # Peek at nextPosition
		yield waitTilNodeAndDestOutsideView(nvd, nextPosition) # Pauses til node and that position are outside of view
		
		# Move to nextPosition
		print 'node and dest are outside view! Moving to next position...'
		node.setPosition(nextPosition)
		seatQueue.rotate(-1) # update seatQueue
		
		print 'waiting til node inside view...'
		yield waitTilNodeInsideView(nvd)
		
		print 'creepily dodging eye contact...'
		yield creepilyMakeEyeContact(node, seatQueue[0], dout)
		
	
		#if seatQueue[0] is not finalSeatPosition:
		print 'waiting 5 seconds then moving him back if hes in view at the end of the 5 seconds.' # TODO: This is not exactly what we want.
		yield moveBackwardsIfStaredAt(node, nvd) # If the node is not in the last seat position,
开发者ID:vhilab,项目名称:homelessness-study,代码行数:59,代码来源:CreepySeatChanging.py


示例8: setAsMain

	def setAsMain(self):
		viz.logStatus('Setting Joyculus as main')

		val = mathlite.getNewRange(self.joy.getSlider(),1,-1,self.MIN_SPEED,self.MAX_SPEED)
		self.MOVE_SPEED = val
		
		vizact.onsensordown(self.joy,self.KEYS['reset'],self.reset)
		vizact.ontimer(0,self.updateView)
		viz.callback(getExtension().SLIDER_EVENT,self.onSliderChange)
开发者ID:justlim77,项目名称:TrussBridgeBuilder,代码行数:9,代码来源:navigation.py


示例9: 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


示例10: __init__

 def __init__(self, scene=viz.Scene1, avatar=None):
   self.scene = scene
   self.avatar = avatar
   self.subwindow = None
   self.subview = None
   self.scale = 0.4
   
   self.initScreen()
   
   if self.avatar is not None:
     self.initAvatar()
     
   vizact.onkeydown(' ',self.toggleVisibility)
   viz.callback(viz.MOUSEWHEEL_EVENT,self.rescale)
开发者ID:vhilab,项目名称:homelessness-study,代码行数:14,代码来源:StoryScreen.py


示例11: main

def main():

    viz.vsync(viz.ON)
    viz.window.setFullscreenMonitor([2])
    viz.setMultiSample(4)
    viz.MainWindow.clip(0.01, 200)

    viz.go(viz.FULLSCREEN)

    environment = viz.addChild("piazza.osgb")
    environment.setPosition(2.75, 0, -0.75)

    mocap = phasespace.Phasespace()

    head = mocap.get_rigidTracker("hmd")

    # DOES NOT ACCOUNT FOR RIGID BODY OFFSET DURING RESET

    # mocap.track_rigid('Resources/hmd-nvisMount.rb', center_markers=(1,2))
    head.link_pose(viz.MainView)

    # glove = mocap.track_points([8, 9, 10])

    paddle = mocap.track_rigid({17: (0, 0, 1), 19: (0, 0, 0), 20: (1, 0, 0), 22: (0, 1, 0)})

    mocap.start_thread()
    # mocap.start_timer()

    def log_mocap(timer_id):
        # print 'glove#9 pos {0[1]:.2f} {0[1]:.2f} {0[2]:.2f}'.format(*glove.get_marker(9))
        print "head    pos {0[0]:.2f} {0[1]:.2f} {0[2]:.2f}, quat {1[0]:.3f} {1[1]:.3f} {1[2]:.3f} {1[3]:.3f}".format(
            *head.get_pose()
        )
        print "main    " + str(viz.MainView.getPosition())
        # print 'paddle  pos {0[0]:.2f} {0[1]:.2f} {0[2]:.2f}, quat {1[0]:.3f} {1[1]:.3f} {1[2]:.3f} {1[3]:.3f}'.format(*paddle.get_pose())

    viz.callback(viz.TIMER_EVENT, log_mocap)
    viz.starttimer(0, 1, viz.FOREVER)

    def keydown(key):

        if key == "h":
            head.reset()
        if key == "H":
            head.save()
        elif key == "1":

            print "Marker Pos: " + str(mocap.get_MarkerPos(1))

    viz.callback(viz.KEYDOWN_EVENT, keydown)
开发者ID:YanjieGao,项目名称:ExperimentBase,代码行数:50,代码来源:phasespace_newTest.py


示例12: __init__

	def __init__(self, handTracker = None):
		
		# These two lines are weird necessities to subclass the VizNode class (which most Vizard objects are?)
		self.node = viz.addChild(Dart._MODEL_FILE)
		viz.VizNode.__init__(self,self.node.id)
		
		self.setScale(Dart._SCALE, Dart._SCALE, Dart._SCALE)
		self.color(1, 0, 0)
		
		self.collideBox()
		self.enable(viz.COLLIDE_NOTIFY)
		viz.callback(viz.COLLIDE_BEGIN_EVENT, onCollide)
		self.initVelocity()
		self.initEuler()
		self.setVelocity([0, 0, 0])
		if handTracker != None: self.attachToHand(handTracker)
开发者ID:vhilab,项目名称:thirdArm,代码行数:16,代码来源:BalloonsClassesOld.py


示例13: __setupTracking__

	def __setupTracking__(self):
		
		#get mocap interface
		self.mocap = Connector.getMocapInterface()

		#Get the shutter-glass rigid body
		self.shutterGlass = self.mocap.returnPointerToRigid(Connector.SHUTTERGLASSES)
		self.head_tracker = viz.link(self.shutterGlass.vizNode,viz.NullLinkable,srcFlag=viz.ABS_PARENT)
		self.cave.setTracker(self.head_tracker)

		# Create cave view
		cave_origin = vizcave.CaveView(self.head_tracker)
		
		#In case you want to override & translate the physical location of cave, uncommnet this
		
		'''
		origin_tracker = viztracker.KeyboardMouse6DOF()
		origin_link = viz.link(origin_tracker, cave_origin)
		origin_link.setMask(viz.LINK_POS)
		'''
		
		#Foot rigidBodies
		leftFootRigid = self.mocap.returnPointerToRigid(Connector.L_FOOT)
		rightFootRigid = self.mocap.returnPointerToRigid(Connector.R_FOOT)
		
		#Foot visuals, make them 100% transparent when not in debug mode
		self.leftFootViz = vizshape.addBox(size=(.2,.2,.2))
		self.rightFootViz = vizshape.addBox(size=(.2,.2,.2))
		
		if(self.debug):
			self.leftFootViz.alpha(0.025)
			self.rightFootViz.alpha(0.025)
		else:
			self.leftFootViz.alpha(0.0075)
			self.rightFootViz.alpha(0.0075)
		
		#Foot class objects
		self.leftFoot = Foot(mocapFootObj = leftFootRigid, name="Left")
		self.rightFoot = Foot(mocapFootObj = rightFootRigid, name="Right")
		
		#setup buffer updates
		vizact.onupdate(0, self.leftFoot.populateNextBufferElement)
		vizact.onupdate(0, self.rightFoot.populateNextBufferElement)
		vizact.onupdate(0, self.updateBooties)
		viz.callback(viz.COLLIDE_BEGIN_EVENT, self.collideDetected)
开发者ID:performlabrit,项目名称:VRWalking-Preliminary,代码行数:45,代码来源:WEnvironment.py


示例14: main

def main():
    viz.setOption('viz.fullscreen.monitor', 1)
    viz.setOption('viz.window.width', 2 * 640)
    viz.setOption('viz.window.height', 480)
    viz.setMultiSample(4)
    viz.MainWindow.clip(0.01, 500)

    vizconfig.register(nvis.nvisorSX111())

    viz.go(viz.FULLSCREEN)

    piazza = viz.addChild('piazza.osgb')

    mocap = phasespace.Mocap('192.168.1.230')

    head = mocap.track_rigid('Resources/hmd-nvis.rb', center_markers=(0, 5))
    head.link_pose(viz.MainView)

    glove = mocap.track_points([8, 9, 10])

    paddle = mocap.track_rigid({
      17:(0, 0, 1),
      19:(0, 0, 0),
      20:(1, 0, 0),
      22:(0, 1, 0),
    })

    mocap.start_thread()
    #mocap.start_timer()

    def log_mocap(timer_id):
        print 'glove#9 pos {0[1]:.2f} {0[1]:.2f} {0[2]:.2f}'.format(*glove.get_marker(9))
        print 'head    pos {0[0]:.2f} {0[1]:.2f} {0[2]:.2f}, quat {1[0]:.3f} {1[1]:.3f} {1[2]:.3f} {1[3]:.3f}'.format(*head.get_pose())
        print 'paddle  pos {0[0]:.2f} {0[1]:.2f} {0[2]:.2f}, quat {1[0]:.3f} {1[1]:.3f} {1[2]:.3f} {1[3]:.3f}'.format(*paddle.get_pose())

    viz.callback(viz.TIMER_EVENT, log_mocap)
    viz.starttimer(0, 1, viz.FOREVER)

    def keydown(*args):
        head.reset()
        paddle.reset()

    viz.callback(viz.KEYDOWN_EVENT, keydown)
开发者ID:EmbodiedCognition,项目名称:tracing-experiment,代码行数:43,代码来源:phasespace_test.py


示例15: setup

def setup():
	global lhPPT, rhPPT, headPPT, headLink;
	global lhSphere, rhSphere
	
	nvis.nvisorSX111();
	#nvis.nvisorSX60();
	viz.mouse.setVisible(False)
	#viz.cursor(viz.OFF);
	view = viz.MainView
	isense = viz.add('intersense.dle')
	headTracker = isense.addTracker(port=1)
	vizact.onkeydown('r',headTracker.resetHeading)
	vrpn = viz.add('vrpn7.dle');
	PPT_HOSTNAME = '171.64.33.43';
	headPPTorig = vrpn.addTracker('[email protected]' + PPT_HOSTNAME, 0);

	#Merge two links together
	headPPT = viz.mergeLinkable(headPPTorig,headTracker)
	headLink = viz.link(headPPT, viz.MainView);
	headLink.postTrans([EYE_VECTOR[0], EYE_VECTOR[1], EYE_VECTOR[2]]);
	
	#now add the PPT hands tracker
	rhPPT = vrpn.addTracker('[email protected]' + PPT_HOSTNAME, 1)
	lhPPT = vrpn.addTracker('PP[email protected]' + PPT_HOSTNAME, 2)
	
	grid = vizshape.addGrid();
	grid.color([0.5] * 3);
	
	viz.callback(viz.KEYDOWN_EVENT, onKeyDown);
	
	if(DEBUG_MODE):
		print "adding spheres";
		rhSphere = vizshape.addSphere(radius = 0.1, color = viz.WHITE);
		lhSphere = vizshape.addSphere(radius = 0.1, color = viz.WHITE);
		rfSphere = vizshape.addSphere(radius = 0.1, color = viz.WHITE);
		lfSphere = vizshape.addSphere(radius = 0.1, color = viz.WHITE);
		

	
	return;
开发者ID:vhilab,项目名称:thirdArm,代码行数:40,代码来源:pptextension.py


示例16: setup

def setup(avatar):
	global headSphere, lhSphere, rhSphere, lfSphere, rfSphere;
	global rhPos, lhPos, rfPos, lfPos, bodyPos;
	
	rhPos = avatar.getBone('Bip01 R Hand').getPosition(viz.ABS_GLOBAL);
	lhPos = avatar.getBone('Bip01 L Hand').getPosition(viz.ABS_GLOBAL);
	rfPos = avatar.getBone('Bip01 R Foot').getPosition(viz.ABS_GLOBAL);
	lfPos = avatar.getBone('Bip01 L Foot').getPosition(viz.ABS_GLOBAL);
	bodyPos = avatar.getBone('Bip01').getPosition(viz.ABS_GLOBAL);
	
	viz.MainView.setPosition(2.2, 0.5, -1.7)
	viz.MainView.setEuler(-110, 0, 0)
	viz.MainWindow.fov(90)
	
	grid = vizshape.addGrid();
	grid.color([0.5] * 3);
	
	global bodyBox;
	bodyBox = vizshape.addBox();
	bodyBox.setScale(0.45, 1.2, 0.35);
	
	bodyBox.visible(viz.OFF);
	
	viz.callback(viz.KEYDOWN_EVENT, onKeyDown);
	
	#link = viz.link(avatar.getBone('Bip01 Head'), viz.MainView)
	#link = viz.link(viz.MainView, avatar.getBone('Bip01 Head'))
	#link.postTrans([0, 0, -0.2]);
	
	if(DEBUG_MODE):
		print "adding spheres";
		rhSphere = vizshape.addSphere(radius = 0.1, color = viz.WHITE);
		lhSphere = vizshape.addSphere(radius = 0.1, color = viz.WHITE);
		rfSphere = vizshape.addSphere(radius = 0.1, color = viz.WHITE);
		lfSphere = vizshape.addSphere(radius = 0.1, color = viz.WHITE);
		
		headSphere = vizshape.addSphere(radius = 0.1, color = viz.YELLOW);
	return;
开发者ID:vhilab,项目名称:thirdArm,代码行数:38,代码来源:pptsimulation.py


示例17: openAvatarRecording

def openAvatarRecording(participantID, controlSchema):
	global filePointerForAvatarData
	filename = 'avatarBoneData/' + participantID + '_' + str(controlSchema) + '_avatarBoneData' + '.dat'
	filePointerForAvatarData = data_recording.openFileForRecordingData(filename, 'w')
	viz.callback(viz.TIMER_EVENT, onTimer)
开发者ID:vhilab,项目名称:fiveArms,代码行数:5,代码来源:hf_playback.py


示例18: runSetOfTrials

def runSetOfTrials():
	global data
	global collided
	global positionList
	global hitPosition
	collided = False
	viz.callback( viz.COLLIDE_BEGIN_EVENT, onCollide )
	positions = createPositions()
	move = vizact.ontimer(0, UpdateMovement)
	variances = []
	accuracys = []	
	
	for i in positions:
		data = ""
		positionList = []
		logger.newTrial()
		environment.point.setPosition(0,parameters.point_height,0)		
		if i == 0:
			[x,z] = polar2cartesian(parameters.radialCoordinate, parameters.angularCoordinate1)
		elif i == 1:
			[x,z] = polar2cartesian(parameters.radialCoordinate, parameters.angularCoordinate2)
		elif i == 2:
			[x,z] = polar2cartesian(parameters.radialCoordinate, parameters.angularCoordinate3)
		elif i == 3:
			[x,z] = polar2cartesian(parameters.radialCoordinate, parameters.angularCoordinate4)
		print [x,z]
		environment.goal.setPosition(x, parameters.goal_height,z)
		data += ( "\nGoal Position: " + str(environment.goal.getPosition()))
		#enable joystick movement
		environment.point.visible(viz.ON)
		environment.goal.visible(viz.ON)	
		if parameters.dreiDEnvironment:
			environment.shadow.visible(viz.ON)
		if (parameters.training or parameters.intro):
			environment.arrow.visible(viz.ON)
		environment.thrust.disable()		
		move.setEnabled(viz.ON)
		#wait till key is pressed let object fall down
		yield s.wait()
		if parameters.dreiDEnvironment:
			environment.shadow.visible(viz.OFF)
		dropPosition = environment.point.getPosition()
		data += ('\nDrop Position: ' + str(dropPosition))		
		move.setEnabled(viz.OFF)
		#set force on the point + no gravity
		[x,z] = windSpeed.computeWindForce(environment.point.getPosition())
		if parameters.dreiDEnvironment:
			environment.thrust.setForce([x,parameters.gravity,z])
		else:
			environment.thrust.setForce([x,0,z])
		environment.thrust.enable();
		#print(environment.point.getPosition())
		yield viztask.waitTime(1)
		#show fallen object
		environment.thrust.disable()
		environment.point.setVelocity([0,0,0])
		yield viztask.waitTime(1)
		#save hit position use global hit position if 3D based on collision or get last position of point in 2d
		if  not parameters.dreiDEnvironment:
				hitPosition = environment.point.getPosition()
		data+= '\nHit Position: ' + str(hitPosition)
		#compute statistics
		accuracy = statistics.computeAccuracy(hitPosition, environment.goal.getPosition())
		variance = statistics.computeVariance(dropPosition, positionList)
		data+= '\nAccuracy: ' + str(accuracy)
		data+= '\nVariance: ' + str(variance)
		#make point invisible wait and start next trial
		environment.point.visible(viz.OFF)
		environment.goal.visible(viz.OFF)
		if (parameters.training or parameters.intro):
			environment.arrow.visible(viz.OFF)
		yield viztask.waitTime(1)
		parameters.trialNumber+= 1
		data+= "\n" + str(positionList)
		logger.write_logger(data)
		accuracys.append(accuracy)
		variances.append(variance)
	viztask.returnValue([variances,accuracys,positions.__len__()])
开发者ID:HerrPeterPaul,项目名称:Masterarbeit,代码行数:78,代码来源:gameLogic.py


示例19: onMouseEnter

import viz

viz.go()

# Create arrow symbol at center of screen
text = viz.addText("^", parent=viz.SCREEN, pos=(0.5, 0.5, 0), align=viz.ALIGN_CENTER_CENTER)

# Import our new module
import mymodule

# Register callback for our mouse enter event
def onMouseEnter(pos):
    text.setEuler(0, 0, -vizmat.AngleToPoint([0.5, 0.5], pos))
    text.color(viz.WHITE)


viz.callback(mymodule.MOUSE_ENTER_EVENT, onMouseEnter)

# Register callback for our mouse leave event
def onMouseLeave(pos):
    text.setEuler(0, 0, -vizmat.AngleToPoint([0.5, 0.5], pos))
    text.color(viz.RED)


viz.callback(mymodule.MOUSE_LEAVE_EVENT, onMouseLeave)
开发者ID:vhilab,项目名称:VRITS-2015,代码行数:25,代码来源:CustomEventTutorial.py


示例20: onCollideBegin

env = viz.add(viz.ENVIRONMENT_MAP, 'sky.jpg',scene=viz.MainScene)
sky = viz.add('skydome.dlc')
sky.texture(env)

TRANSLATE_INC = .2
ROTATION_INC = 2
SCALE = [0.03, 0.03, 0.03]
room = viz.add("../models/room2/room2.wrl")
room.setScale(SCALE)

ground = viz.add('tut_ground.wrl')
ground.setScale([5,1,5])
#viz.translate(viz.HEAD_POS,0,20,-20)
#viz.lookat(0,0,0)
viz.clearcolor(viz.SKYBLUE)


vizact.whilekeydown(viz.KEY_UP,viz.move,0,0,TRANSLATE_INC) #Move forward while up key is pressed
vizact.whilekeydown(viz.KEY_DOWN,viz.move,0,0,-TRANSLATE_INC) #Move backward while down key is pressed
vizact.whilekeydown(viz.KEY_LEFT,viz.rotate,viz.BODY_ORI,-ROTATION_INC,0,0) #Turn left while left arrow pressed
vizact.whilekeydown(viz.KEY_RIGHT,viz.rotate,viz.BODY_ORI,ROTATION_INC,0,0) #Turn right while right arrow pressed


def onCollideBegin(e):
	global pg
	if pg.abe.avatar == e.obj1:
		pg.abe.collision()
viz.callback(viz.COLLIDE_BEGIN_EVENT, onCollideBegin)

pg = path.PathGenerator()
viztask.schedule(pg.generatePaths())
开发者ID:rajeshnarasimha,项目名称:arimmersion,代码行数:31,代码来源:runpath.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python viz.fov函数代码示例发布时间:2022-05-26
下一篇:
Python viz.addText函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap