Collision on dynamic ground

Hi,

I have some problem picking my heightfield.

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 ?

Thanks a lot
Gruik

ynjh_jo wrote a function to convert normal geometry to collisiongeometry (see this thread).

Thanks it certainly will help!

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!

Thanks again
Gruik

I should mention that checking the heightfield directly should be much faster than converting to polygons and then checking collision against the polygons.

Yes, in the next version of PGMM I hope to have an automatic collisiongeometry-generator built-in.

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 ?