Example #1
0
	def onKeyDown(self,key):
		if key == '1':
			self.avatar.stopAction(1)
			self.avatar.state(0)
		elif key == "2":
			self.avatar.state(1)
		elif key == "3":
			mySound = viz.addAudio( 'mazin.mp3' )
			mySound.loop( viz.ON )
			mySound.play()
			#self.avatar.execute(1)
			#opening video test
			#title text
			self.textScreen = viz.addText('Mazinger Animation Demo',viz.SCREEN)
			#self.textScreen.alignment(viz.ALIGN_CENTER_BOTTOM)
			self.textScreen.setScale([1,1,1])
			#self.textScreen.setPosition([0,10,0])
			self.starttimer(2,1,22)
			self.object = viz.addTexQuad(size=2)
			video = viz.addVideo('open.avi')
			video.setRate(1)
			video.volume(0) 
			video.play()
			#fixing video position
			self.object.texture(video)
			self.object.setAxisAngle( [0, 1, 0 , 180] ) 
			self.object.setPosition([0,10,18])
			
			#self.avatar.setAnimationSpeed(1, .5) #run at half speed
		elif key == "4":
			viz.MainView.setPosition([0,10,20])
			viz.lookAt([0,10,0])
			self.starttimer(1,1,8)
			self.avatar.execute(2)
Example #2
0
def loadTexQuads(num):
	if num == 2:
		globals_oa.CANVAS_QUAD = viz.addTexQuad(size=globals_oa.promptQuadSize, scene=viz.Scene2)
	else:
		globals_oa.CANVAS_QUAD = viz.addTexQuad(size=globals_oa.promptQuadSize)
	globals_oa.CANVAS_QUAD.drawOrder(10000)
	globals_oa.CANVAS_QUAD.disable(viz.DEPTH_TEST)
	globals_oa.CANVAS_QUAD.setPosition(globals_oa.promptQuadPos)
	globals_oa.CANVAS_QUAD_1_TEXTURE = viz.addTexture('resources/card_species.jpg')
	globals_oa.CANVAS_QUAD_1_TEXTURE.hint(viz.PRELOAD_HINT)
	globals_oa.CANVAS_QUAD_2_TEXTURE = viz.addTexture('resources/card_pickup.jpg')
	globals_oa.CANVAS_QUAD_2_TEXTURE.hint(viz.PRELOAD_HINT)
	globals_oa.CANVAS_QUAD_3_TEXTURE = viz.addTexture('resources/divebasketslate.jpg')
	globals_oa.CANVAS_QUAD_3_TEXTURE.hint(viz.PRELOAD_HINT)
	globals_oa.MOVIE_INSTRUCTION_QUAD = viz.addVideo('resources/swim_card.MOV')
	#globals_oa.MOVIE_INSTRUCTION_QUAD.hint(viz.PRELOAD_HINT)
	globals_oa.CANVAS_QUAD.disable(viz.FOG)
	globals_oa.CANVAS_QUAD.visible(False)
targetR = 1

global targettol
targettol = 0.05

global boxL
boxL = viz.addChild('target.obj',color=(0.063,0.102,0.898),scale=[0.1,(targettol+0.04)*0.75,0.0125])
boxL.setPosition([-0.2,targetL*scalorxx,0])

#place quad behind to show movie
global rvideo
global lvideo
global Rquad
global Lquad

rvideo = viz.addVideo('RightSuccess0001-0040.avi')
lvideo = viz.addVideo('LeftSuccess0001-0040.avi')
#rvideo.loop()
#lvideo.loop()
#rvideo.play()
#lvideo.play()

Rquad = viz.addTexQuad(pos=[0.5,targetR*scalorxx,0],scale = [.5,.5,0])
Rquad.texture(rvideo)
Lquad = viz.addTexQuad(pos=[-.5,targetL*scalorxx,0],scale = [.5,.5,0])
Lquad.texture(lvideo)

global boxR
boxR = viz.addChild('target.obj',color=(0.063,0.102,0.898),scale=[0.1,(targettol+0.04)*0.75,0.0125])
boxR.setPosition([0.2,targetR*scalorxx,0])
#targetR = 0.562
#targetR = 0.429
targetR = 0.4385

global targettol
targettol = 0.025# 5cm

#place quad behind to show movie
global rvideo
global lvideo
global Rquad
global Lquad

#rvideo = viz.addVideo('RightSuccess0001-0040.avi')
#lvideo = viz.addVideo('LeftSuccess0001-0040.avi')
rvideo = viz.addVideo('Righthair.avi')
lvideo = viz.addVideo('Lefthair.avi')
#rvideo.loop()
#lvideo.loop()
#rvideo.play()
#lvideo.play()

Rquad = viz.addTexQuad(pos=[0.5,targetR,0.10],scale = [.5,.5,0])
Rquad.texture(rvideo)
Lquad = viz.addTexQuad(pos=[-0.5,targetL,0.10],scale = [.5,.5,0])
Lquad.texture(lvideo)

#declare the total number of steps to attempt (this is the accumulation of steps total, i.e. 75 R and 75 L means 150 total attempts)
global STEPNUM
STEPNUM =20
#setup array of randomly picked steps
Example #5
0
	def onTimer(self,num):
		#animation for flight
		if num == 1:
			self.count2 = self.count2+1
			print(self.count2)
			if self.count2 == 1:
				
				viz.MainView.runAction(vizact.move([0,1,0],2))
			elif self.count2 == 2:
				
				viz.MainView.runAction(vizact.move([0,0,-1],3))
			elif self.count2 == 5:
				x=0
				viz.MainView.runAction(vizact.spinTo(point=[0,30,0],time=2))
			elif self.count2 == 9:
				#end of flight or state 2
				self.avatar.stopAction(2)
				self.avatar.state(0)
				viz.MainView.setPosition([0,10,20])
				viz.lookAt([0,10,0])
				self.object2 = viz.addTexQuad(size=10)
				self.object = viz.addTexQuad(size=2)
				self.object2.setPosition([0,10,17])
				video = viz.addVideo('fly2.avi')
				video.setRate(1)
				video.volume(0) 

				video.play()
				self.object.texture(video)
				self.object.setAxisAngle( [0, 1, 0 , 180] ) 
				self.object.setPosition([0,10,18])
				#destroy stage for illusion flightand start next state
				self.model.remove()
				self.avatar.state(3)

				#start next part and reset cound
				self.count2 = 0
				self.starttimer(3,1,28)
		elif num == 2:
			#start of animation
			self.count = self.count +1
			print(self.count)
			if self.count == 17:
				self.textScreen.remove()
				self.object.remove()
				self.avatar.state(1)
			elif self.count == 20:
				self.avatar.stopAnimation(1)
			elif self.count == 22:
				#start flight
				self.starttimer(1,1,8)
				self.avatar.execute(2)
		elif num == 3:
			self.count2 = self.count2 + 1
				

			if self.count2 == 9:
				#adding last stage
				viz.MainView.runAction(vizact.move([0,0,-1],7))
				self.object3 = viz.addTexQuad(size=55)
				video = viz.addVideo('skyanim.avi')
				video.setRate(1)
				video.volume(0) 
				video.play()
				video.loop()
				#fixing video position
				self.object3.texture(video)
				self.object3.setAxisAngle( [0, 1, 0 , 180] ) 
				self.object3.setPosition([0,10,-10])
				self.object4 = viz.addTexQuad(size=50)
				
				self.object4.setPosition([0,10,-11])
				self.object.remove()
				self.object2.remove()
	def setVideo(self, videoFile):
		if self.video: self.video.remove()
		self.video = viz.addVideo(videoFile)
		self.video.loop(viz.ON if self.loopEnabled else viz.OFF)
		self.screen.texture(self.video)
Example #7
0
# Add a viewpoint so the user starts at [0, 0, 0].
vp = vizconnect.addViewpoint(pos=[0, 0, 0])

scenario = [
    'art/Domus_Guitar_Brendan.osgb', 'art/Domus_Guitar_Zach.osgb',
    'art/Domus_Guitar_Rob.osgb'
]
choice = random.randint(0, 2)
print(choice)

# Load the model for the room.
room = viz.addChild(scenario[choice])
room.hint(viz.OPTIMIZE_INTERSECT_HINT)

# Add a video to play it on each TV.
media = viz.addVideo('art/cartoon-bird.wmv')

# Get the handles to the TV objects in the living room, the main bedroom and the kid's room,
# and apply video texture to the objects.
TVscreen1 = room.getChild('SL_TV Screen')
TVscreen1.texture(media)

TVscreen2 = room.getChild('Object03x')
TVscreen2.texture(media)

TVscreen3 = room.getChild('TV screen Suite')
TVscreen3.texture(media)

drawer = room.getChild('Drawer')
pillow1 = room.getChild('Cushion')
pillow2 = room.getChild('Cushion2')
Example #8
0
gallery = viz.addChild('resources/barber_shop.osgb')
door = gallery.getChild('door')

# level settings for the hmd - taken from the vizard vive example
gallery.hint(viz.OPTIMIZE_INTERSECT_HINT)
gallery.disable(viz.SHADOW_CASTING)

# setting door center to fix the pivot/rotation point
door.setCenter([-5, 0, 0])
#load the tV model and set its position and rotation
tv = viz.addChild('resources/monitor2.osgb')
tv.setPosition(0, 2.5, -2.2)
tv.setEuler(0, 40, 0)

# video texture
video = viz.addVideo('resources/hale_bopp_1.mpg')
video.play()
video.loop()
#video.volume(1)

#creating a plane that holds the video texture
screen = vizshape.addPlane([0.9, 0.55, 0.9], axis=vizshape.AXIS_Z)
screen.setEuler(45, 0, 0)
screen.texture(video)

#link the plane to the tv model
viz.link(tv, screen, offset=[0, 0.22, 0.24])

# for exporting osgb file into other file formats - useful
# gallery.save('model/shop.fbx')
Example #9
0


# create skylight
viz.MainView.getHeadLight().disable()
sky_light = viz.addLight(euler=(0,90,0))
sky_light.position(0,0,-1,0)
sky_light.color(viz.WHITE)
sky_light.ambient([0.9,0.9,1])

# add the gallery model
gallery = viz.addChild('gallery.osgb')

# add audio and video
music = viz.addAudio('bach_air.mid',loop=1)
video = viz.addVideo('vizard.mpg',play=1,loop=1)

# get a handle to Starry Night texture
painting = gallery.getTexture('painting_starry-night')

# add an avatar
avatar = viz.addAvatar('vcc_male2.cfg',pos=[0,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()

# move avatar around the room with a sequence of walk, turn, and wait actions
Example #10
0
proj_board = viz.addTexQuad(pos=(1.4, 2.4, 5.4))
proj_texture = viz.addTexture('resource/projector.JPG')
proj_board.texture(proj_texture)
proj_board.billboard(viz.BILLBOARD_YAXIS)
proj_board.visible(False)

# ペッパー
peppar = viz.addChild('resource/Pepper.osgb',
                      pos=(-9, .6, -4.7),
                      euler=(-90, 0, 0))
peppar_sensor = vizproximity.Sensor(vizproximity.CircleArea(3), source=peppar)
manager.addSensor(peppar_sensor)

# ペッパーの紹介
peppr_obj = viz.add('box.wrl', pos=[-8.5, 2.8, -4.7], color=viz.WHITE)
pepper_video = viz.addVideo('resource/pepper.avi')
peppr_obj.texture(pepper_video)
pepper_video.setFrame(10)
peppr_obj.alpha(0)

# wifi
wifi = viz.add('resource/wifi.osgb', pos=[-2, 2, 0])
wifi.addAction(vizact.spin(0, 1, 0, 10, viz.FOREVER))

#机とバリスタ
table = viz.addChild(
    'resource/COWVRT3672+-+COALESSE-TBL,RECT,VENEER,36X72X28.osgb',
    pos=[-3, 0, 6])
barista = viz.add('resource/8000s.osgb',
                  pos=[-3.5, 0.75, 5.8],
                  euler=(90, 0, 0))