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