View Single Post
  #16  
Old 02-21-2007, 10:27 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The vzf files you included contain about 20,000 polygons. This is most likely dropping your framerate and causing Vizard to be jumpy. You should consider using a lower resolution head.

Also, every time you hit the 'w' or 'b' key, you are loading a new face, instead of reusing an existing one. This will definitely kill your frame rate after a while. I posted a new version of your script that pre-loads the faces and only displays one at a time. It also fixes the problem with the heads overlaying each other.
Code:
import viz
viz.go(viz.FULLSCREEN)

#viz.collision(viz.ON)

#ALL TRACKER INITIALIZATION
#PORT_INTERSENSE = 3
#myTracker = viz.add('intersense.dls')
#PORT_PPT = 1
#ppt1 = viz.add('vizppt.dls')
#viz.tracker()
#myTracker.reset()  # Reset the tracker

music = viz.add('Soundtrack6.mp3')
#music.play()
music.loop(viz.ON)

target = viz.add('male.cfg')
target.translate(-2,0,0)
target.rotate(0,1,0, 90)
target.state(1)
#target.face('Stephen.vzf')
#target.face('biohead_talk.vzf')

whiteHead = viz.add('VRwhitemale.vzf')
blackHead = viz.add('VRblackmale.vzf')
whiteHead.visible(0)
blackHead.visible(0)

def ChangeMusic(next):
	global music
	music.stop()
	music = viz.add(next)
	music.play()

def StopTheMusic():
	global music
	music.stop()

def mykey(key): 
	if key == '1':
		ChangeMusic('Soundtrack1.mp3')
	elif key == '2':
		ChangeMusic('Soundtrack2.mp3')
	elif key == '3':
		ChangeMusic('Soundtrack3.mp3')
	elif key == '4':
		ChangeMusic('Soundtrack4.mp3')
	elif key == '5':
		ChangeMusic('Soundtrack5.mp3')
	elif key == '6':
		ChangeMusic('Soundtrack6.mp3')
	elif key == ' ':
		StopTheMusic()
	elif key == 'w':
		target.face(whiteHead)
		whiteHead.visible(1)
		blackHead.visible(0)
	elif key == 'b':
		target.face(blackHead)
		blackHead.visible(1)
		whiteHead.visible(0)

#viz.eyeheight(1.5)

viz.callback(viz.KEYBOARD_EVENT,mykey)
The solution to the jumpiness is to either upgrade your computer/graphics card or use a lower poly version of the head.
Reply With Quote