pick() very slow on terrain mesh

hi, i’m developing my first 3d game using m3g.
it is a space shoot’em up.
i implemented the terrain with heightmaps using a single triangle strip and i have the spaceship (a cube, at the moment) flying around the surface of the planet.
the fps were about 30 on my nokia n70, not bad;
today i tried to add the collision between the ship and the terrain but i discovered that the pick() method is terribly slow on my mobile…
here is the instruction:


if (terrain.group.pick(-1, lander.position[0], lander.position[1], lander.position[2], temp[0], temp[1], temp[2], ray))
{
//no code here!
}

“terrain” is an instance of a class written by me that implements the heightmap, “group” is a Group that has just the terrain mesh as child, “lander” is the spaceship and “temp” is the direction vector.
The code works, but it’s extremely slow, about 4fps on my phone, i tried to lower the complexity of the terrain and the situation improves, but not enough.
the terrain at the moment has 2738 triangles, 1444 vertices and 8214 indices. with this mesh i get 8fps…
commenting the pick() call, fps return to about 30 fps.

is this normal or am i wrong in something?

what can i do to implement the collision with the terrain?
i don’t want to lower further the number of polygons of the terrain…

thank you

yup, picking is slow on every handset i’ve tried it on. Typcially ranging from bad, to catastrophic.

One way to get around it is not to pick every frame, if that is enough for you to work with.

Or simply not use it at all.

Do you realy need collision detection accurate to the visual geometry? or will a more simplified approach suffice.

i thought about a solution…
i could split the terrain in many smaller meshes and many groups, then use the position of the ship to determine on which group/mesh i have to test the collision with the pick() method.
this way the pick() method will be performed on a as little as i want number of polygons…
hope this works…

what are you picking for? Are you picking so that your spaceship stays above the terrain and goes up and down?
If so, you dont need picking. What you want to do is LERP between the 4 nearest grids on your heightmap.

DP

LERP?

Google?