I have many objects in CollisionTraverser()

Hi

I have many objects in CollisionTraverser(). exactly 50 objects (objects are “for Clicking”). Problem is that with so many objects memory consumption is very high, the pc slows. Any solutions?

Thanks.

It is probably a problem with your code rather than the number of objects. Show some code, otherwise it is not possible to help.
If you are using geometry instead of simple shapes like CollisionSphere that could also be a problem.

OK. I am working with the sample code “chessboard” but I need cubes and no plans, by so added cube.egg with “CollisionBox” for collisions with mouse.
Code:

    self.picker = CollisionTraverser()           
    self.pq = CollisionHandlerQueue()       
    self.pickerNode = CollisionNode('mouseRay')
    self.pickerNP = camera.attachNewNode(self.pickerNode)
    self.pickerNode.setFromCollideMask(BitMask32.bit(1))
    self.pickerRay = CollisionRay()               
    self.pickerNode.addSolid(self.pickerRay)      
    self.picker.addCollider(self.pickerNP, self.pq)
   


    for i in range(44):
            self.cubos[i] = loader.loadModel("models/cube")
            self.cubos[i].reparentTo(self.cube2)
            self.cubos[i].setPos(cubePos(i))
            self.cubos[i].setScale(0.5,0.5,0.5)
            self.NC= CollisionNode('self.cubeList[i]')
            self.NC.addSolid(CollisionBox((0,0,0),1,1,1))
            self.aC = self.cubeList[i].attachNewNode(self.NC)
            self.aC.setTag('cube', str(i)) #self.aC.show()
            self.cubos[i].node().setIntoCollideMask(
              BitMask32.bit(1))



the code works well, but consumes a lot of memory and resources.