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_geo.setHeightfield(terrain_types[type])
terrain = terrain_geo.getRoot()
# Set terrain properties
terrain_geo.setBlockSize(50)
terrain_geo.setNear(500)
terrain_geo.setFar(1000)
terrain_geo.setFocalPoint(base.camera)
terrain_geo.setMinLevel(2)
terrain.setSz(30)
terrain.reparentTo(render)
# 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'))
collisionShape.node().addSolid(collisionBounds)
collisionShape.node().show()
If anyone could help it would be greatly appreciated!!