I create a world from a greyscale heightmap. The heightfield i get is 1 Geom containing GeomTriangles (i don’t use .egg 'cos my heightfield is fully dynamic and if find it easier this way).
So everything’s good : I have an heightfield on the screen (and objects placed on it at the good height.)
But now i want to click on my heightfield and retrieve the good coords. So i have to be able to pick my heightfield. So I need a ColisionSolid.
I saw on the forum that lots of people tag their .egg so that they have it automaticaly but that doesn’t work for my kind of heightfield.
I kept looking and find this in the API : CollisionFloorMesh. I saw you give it vertices and triangles and it’s good.
PROBLEM : it seems it’s not in Panda anymore!
So I think I’ll have to create CollisionPolygon for each triangle of my GeomTriangles but I find it really heavy.
Does anyone have an idea that could help me ? Or at least a way to create a CollisionSolid from a Geom automaticaly ?
I did approximatively the same thing this afternoon (in fact it doesn’t take so much time to compute, even for a big heightfield) but just for GeomTriangles. So this generic one will make be better!
I should mention that checking the heightfield directly should be much faster than converting to polygons and then checking collision against the polygons.
The problem here is that, in order to check the heightfield, I have to project my mouse position on the heightfield to have a x,y coord and then the height of the point … So the only way I see is this one which gives me the 3 coords at the same time.
Do you have an idea about how you would do ?