PDA

View Full Version : Vizard AR Problem.....


allanjjj
03-28-2012, 09:08 PM
i saw the code below is to display avatar only when the marker is shown, but when I run the script, the avatar still shows and jump randomly if no marker is shown in Camera. Is there any problem with the code below?

import viz
viz.go()

#Add ARToolkit extension
ar = viz.add('artoolkit.dle')

#Create camera using first available webcam
camera = ar.addWebCamera()

#Create matrix marker
marker = camera.addMatrixMarker(0,width=1000)

#Add avatar model and set state 1
avatar = viz.add('vcc_male.cfg')
avatar.state(1)

#Link avatar model to marker sensor
viz.link(marker,avatar)

#Method that update if the marker is visible
def updateVisible():
if marker.getVisible():
avatar.visible(viz.ON)
else:
avatar.visible(viz.OFF)

vizact.ontimer(0,updateVisible)

Jeff
03-30-2012, 08:16 AM
How long is the marker out of view, a fraction of a second or several seconds? Are other markers in view? The code looks fine but you may have problems if the marker flashes in and out of view or if something else is seen as a marker.