Darkmax
06-09-2010, 08:21 AM
im trying to make a simple application with physics and augmented reality.
I want just display a logo above the marker and if i roll the marker the logo will fall from the marker.
But the logo collide s little high above the plane and doesn't fall from the plane when i roll the marker.
import viz
viz.go()
viz.phys.enable() # Enable physics
viz.phys.setGravity(0,-9.8/6,0) #Half Gravity
#Add ARToolkit extension
ar = viz.add('artoolkit.dle')
#Create camera using first available webcam
camera = ar.addWebCamera()
#Create marker from pattern file
marker = camera.addMatrixMarker(10,width=1000)
#Ground
ground = viz.add('tut_ground.wrl')
ground.setScale(0.03,1,0.03)
ground.alpha(0)
ground.collidePlane() # Collide Plane
logo = viz.add('logo.wrl') # Add logo
viz.link(marker,ground)
logo.setScale(0.5,0.5,0.5)
logo.collideBox(bounce=1)
logo.add('box.wrl',alpha=.2,scale=logo.getBounding Box(viz.REL_LOCAL).size)
def resetLogo():
x,y,z = ground.getPosition()
logo.setPosition([x,y+2,z])
vizact.onkeydown(" ",resetLogo)
I want just display a logo above the marker and if i roll the marker the logo will fall from the marker.
But the logo collide s little high above the plane and doesn't fall from the plane when i roll the marker.
import viz
viz.go()
viz.phys.enable() # Enable physics
viz.phys.setGravity(0,-9.8/6,0) #Half Gravity
#Add ARToolkit extension
ar = viz.add('artoolkit.dle')
#Create camera using first available webcam
camera = ar.addWebCamera()
#Create marker from pattern file
marker = camera.addMatrixMarker(10,width=1000)
#Ground
ground = viz.add('tut_ground.wrl')
ground.setScale(0.03,1,0.03)
ground.alpha(0)
ground.collidePlane() # Collide Plane
logo = viz.add('logo.wrl') # Add logo
viz.link(marker,ground)
logo.setScale(0.5,0.5,0.5)
logo.collideBox(bounce=1)
logo.add('box.wrl',alpha=.2,scale=logo.getBounding Box(viz.REL_LOCAL).size)
def resetLogo():
x,y,z = ground.getPosition()
logo.setPosition([x,y+2,z])
vizact.onkeydown(" ",resetLogo)