base.cTrav.addCollider causes a runtime Error

Here is my code:
main code:

import direct.directbase.DirectStart
from pandac.PandaModules import CollisionTraverser
import Room

ColTraverser= CollisionTraverser('traverser name')
base.cTrav = ColTraverser

room= Room.Room(1)

run()

Room.py

from direct.showbase.DirectObject import DirectObject
from pandac.PandaModules import BitMask32
from pandac.PandaModules import CollisionHandlerQueue

class Room(DirectObject):
	__ri= 0
	__model_room= 0
	
	def __init__(self, id):
		self.__createRoom()

	def __createRoom(self):
		self.__model_room= loader.loadModel( 'res/garden.egg' )
		
		#put it in the render tree
		self.__model_room.reparentTo( render )
		
		collisions= self.__model_room.find("**/*/gardenColl")
		#print 'collisions ', collisions
		
		# Set the collision bit in the IntoCollideMask
		collisions.node().setIntoCollideMask( BitMask32.bit(0) )
		
		self.colhandler= CollisionHandlerQueue()
		
		print base.cTrav
		base.cTrav.addCollider( collisions, self.colhandler )

If i remove the last line it works, if not i get a Runtime Error!
I have Panda3D-1.2.2. compiled on windows with MSVC++ 7.1

Whats the matter?

I found the problem: The model file
garden.egg
maps/garden2_final.tif

Can somone tell me why this file crashes Panda?

In what way does it crash? What is the error message that it reports, and on what line?

David

It crashes in that line where i add the collsion node to the traverser. .addCollider( ).
This is the error message

I think the collsion node is too big or something

Yes, you’re right–the collision node in question holds 456 CollisionPolygons, and you’re trying to add them all to the collision traverser as a “from” object. So you’re trying to add 456 “from” objects to the collision traverser, and this is overwhelming the system.

Granted, it should have a more graceful error message than this. But the fact is, what you are doing is a mistake anyway.

You are confusing the “into” objects with the “from” objects. Remember, the walls of your garden will be “into” objects–they are static walls of the environment that your “from” objects will test for collisions, but they are not the moving objects themselves. In fact, CollisionPolygons cannot be used as “from” objects anyway.

In order to use your garden walls as “into” objects, you only need to set the bitmask appropriately. It is not necessary to add the “into” objects to the collision traverser–that makes them “from” objects. So if you remove the addCollider() line, you should be fine.

Of course, you do still have 456 CollisionPolygons in one group, which is quite a few. Runtime performance may be poor. You might consider simplifying your geometry for the purposes of detecting collisions, or at least subdividing it into several different groups based on proximity, for instance, one for each of the four corners of the quad.

David

Thanks David. You are the best g
I think now i understand collsiondection with Panda.
Martin