ArToolkit

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()

Sure, just reparent your objects to the nodepath that is attached to the floor pattern (rather than reparenting to render).
The joys of the scene graph. :slight_smile:

Hi,
I don’t know how you can reparent the object to the nodepath that is attached to the floor pattern

If you can help me, it would be really nice,

Regards.

Perhaps it would help if you clarified the nature of your confusion. Are you uncertain how to find the NodePath that is attached to the floor pattern? Are you unsure what reparenting means? Are you uncertain about what a NodePath is?

These questions are generally fundamental to Panda’s operation. If you haven’t done so already, it might help considerably to read through at least the first few pages of the manual, and/or to look at some of the sample programs.

Or, if you do already have a solid understanding of these fundamental concepts, but you have a more specific difficulty, perhaps it would help to clarify precisely what’s going wrong in your attempts. :slight_smile:

David