# putting enemies on the ground

i want to make a game with uneven terrain, so all objects must stick to the floor. for static objects its not difficult, i just use a floorcollider for half a second and then remove it from the list, but making more moving things other than the main character stick to the floor permanently like this causes heavy lagg.

has anyone got an idea on other systems i can use that require less calculating?

Are you using a GeoMipTerrain for your uneven terrain? If so, I believe that GeoMipTerrain provides a method that returns the terrain height for a given point (although note that you may find it called for that you apply to your point any scaling that you’ve applied to the terrain).

If you’re not using a GeoMipTerrain, but do have collision geometry for your terrain, you might get away with using a simple ray collision, as I believe that Roaming Ralph does.

How many objects are you attempting to place?

i dont use geomipterrain. i have before, but it wasnt nearly accurate enough, you “jumped” up and down.

at least a couple, but every single one seems to halve my frame rate (starts at abou 40, but the main character allredy reduces it to 20) in the best case, an entire army of them, but i know thats not possible.

currently, i just treat them as static objects (they dont move), but they are supposed to attack you.

That seems very odd to me.

How are you handling your terrain at the moment (is it, for example, just a single collision mesh), and how big is it?

What sort of collision geometry are you using for your characters? (For example, are you using their visible geometry or collision shapes?)

the characters have a collisionray and collisionhandlerfloor.
the world has a collision mesh, dividedin four parts, because i couldnt get it right in one, as the world itself is divided as well

the world is quite big, because you would otherwise be biger than the world, and downscaling my character fucks up the collision handler.

Wait… Do you have a separate CollisionHandlerFloor for each character? If so, why not just use a single handler and add each character to it?

Otherwise, how many polygons has your terrain? Could it be that you have a very high polygon-count, slowing things down?

i guess its the polygon count, yes. should i call a flatten method?
everything is run with one floorhandler.

Hmm… Collision isn’t really my forte, I fear, but nevertheless:

1. How many polygons has your terrain? It may be that you want either to produce a lower-poly version for collision, or simply to reduce the polygon count of your terrain itself.

2. Since you mention flattening, is your terrain composed of multiple geoms per “terrain chunk”?

3. I suspect it may actually be better to split your terrain further rather than flattening – divide it into more than four parts, in other words. This might allow the collision system to better cull which parts to collide against.