Ive searched the Forums for a while now but didnt find a solution.
now ive created a picker with a code like this:
self.mousequeue = CollisionHandlerQueue()
self.mouseraynode = CollisionNode('mouseray')
self.mouseray = CollisionRay()
self.mouseraynode.addSolid(self.mouseray)
self.mouseraynodepath = camera.attachNewNode(self.mouseraynode)
self.mouseraynode.setFromCollideMask(GeomNode.getDefaultCollideMask())
self.mousetrav = CollisionTraverser("mousetrav")
self.mousetrav.addCollider(self.mouseraynodepath, self.mousequeue)
step by step like in the tutorial.
this is the rest is like in the tut as well:
if base.mouseWatcherNode.hasMouse():
mpos=base.mouseWatcherNode.getMouse()
self.mouseray.setFromLens(base.camNode, mpos.getX(), mpos.getY())
self.mousetrav.traverse(render)
if self.mousequeue.getNumEntries() > 1:
i = 0
self.mousequeue.sortEntries()
while (i < self.mousequeue.getNumEntries() ):
obj = self.mousequeue.getEntry(i).getIntoNodePath()
parent = obj.getParent()
while parent != render:
currentpos = parent
parent = parent.getParent()
if currentpos.getTag('map') == 'true':
currentmouse = self.mousequeue.getEntry(i).getSurfacePoint(render)
self.currentmousepos = currentmouse
i = self.mousequeue.getNumEntries()
i = i+1
the problem is, that it works only on special surfaces. I get a collision if I look at the stones in the roamingralph map but not if i look at the ground it wont work.