Collision plane for selectable terrain.

Hello! I am having a problem adding a plane collisionShape to my terrain. My terrain is made up of different tiles that are GeoMipTerrains. So i want them to be able to be selected by a mouse, but i figure the easiest way to do this would be to first make a collision plane for each tile. I am just having a little trouble getting the following code to work (shape isnt showing up when i call the show() function):

			terrain_geo = GeoMipTerrain("Terrain Tile (" + str(x) + "," + str(y) + ")")
			terrain = terrain_geo.getRoot()

			# Set terrain properties
			# setting up colision detection shape
			collisionBounds = CollisionPolygon(Point3(0, 0, 0), Point3(0, 0, 100), Point3(0, 100, 100), Point3(0, 100, 0))

			terraincollisionShape = terrain.attachNewNode(CollisionNode('Terrain(' + str(x) + str(y) + ') CollisionShape'))

If anyone could help it would be greatly appreciated!!

Hmm, are you getting an error message when you call show()? I would expect one, because show() isn’t a method of CollisionNode, it’s a method of NodePath. So you should call instead of collisionShape.node().show(). If you’re not getting an error message, I’d have to wonder whether this code is being run at all.

Also, note that Panda is Z-up by default, so you appear to have constructed a vertical wall, 3000 units high (it will inherit the Z-scale of its parent, 30).


Thanks for the reply david. I fixxed that and solved it i think.