Hi,
I’m doing some tests with Panda’s Artoolkit funcionality.
I’m able to attach a NodePath object (with a 3d model preloaded) to a physical mark.
The ArtoolKit engine automatically update the Camera field of view as well as the NodePath’s attached to the ArToolkit instance as well.
But me question is, I want to use some physical markers (a big one) to define the “game” floor. So I will use this marker as a “camera tracking” system. So I want to put others models to the scenegraph without attaching them to a physical mark so using model.setPos() will put the model on the specific scenegraph position relative to the “table” marker. Is this possible? I try to insert a non-attached model into the scenegraph but it wasn’t displayed.
Regards
Example:
from pandac.PandaModules import *
from direct.directbase.DirectStart import *
from time import *
i = 0.0
def update(task):
global i
if cursor.ready():
'''
if i < 1:
i = i +0.1
else:
i = 0.0
'''
cursor.fetchIntoTexture(0, videoTexture, 0)
#model.setScale(i)
#print model.getX()
toolkit.analyze(videoTexture)
return task.cont
base.camLens.setNear(0.1)
#Check later
#base.camNode.getDisplayRegion(0).setDimensions(0, 1 + 0.3202, 0 - 0.0169, 1 + 0.0169)
option = WebcamVideo.getOption(0)
cursor = option.open()
videoTexture = Texture(‘movie’)
cursor.setupTexture(videoTexture)
videoTextureScale = Vec2(option.getSizeX()/float(videoTexture.getXSize()), option.getSizeY()/float(videoTexture.getYSize()))
cardMaker = CardMaker(‘cardMaker’)
cardMaker.setFrame(-4/3.0,4/3.0,-1,1)
#Next config sucks
#cardMaker.setUvRange(Point2(videoTextureScale[0],0), Point2(0,videoTextureScale[1]))
#but this sucks with a black left screen
cardMaker.setUvRange(Point2(1,0), Point2(0,videoTextureScale[1]))
card = render.attachNewNode(cardMaker.generate())
card.setTexture(videoTexture)
card.setTwoSided(True)
card.setY(5)
card.setScale(1.72)
card.setSx(-card.getSx())
card.setBin(“fixed”, -1)
card.setDepthTest(False)
card.setDepthWrite(False)
‘’’
model = loader.loadModel(“panda”)
model.setScale(0.5,0.5,0.5)
model.reparentTo(render)
model.setBin(“fixed”, 1)
model.setDepthTest(False)
model.setDepthWrite(False)
‘’’
axis = loader.loadModel(“yup-axis”)
axis.setScale(.2)
axis.reparentTo(render)
#axis.setDepthTest(False)
#axis.setDepthWrite(False)
#Test
model1 = loader.loadModel(“panda”)
model1.setScale(0.5,0.5,0.5)
model1.reparentTo(render)
model1.setBin(“fixed”, 1)
model1.setPos(0,0,0)
model1.setDepthTest(False)
model1.setDepthWrite(False)
toolkit = ARToolKit.make(base.cam, Filename(“camera_para.dat”), 1)
toolkit.attachPattern(Filename(“patt.hiro”), axis)
sleep(3)
taskMgr.add(update, “update”,-100)
run()