Is there any way I can detect when a run-time terrain edit causes a player to fall through the world, and bump the player back above ground?
I'm allowing players to raise and lower the heightmap of the terrain in game, whilst using a first person camera. This means they can potentially raise the terrain below their feet, which currently causes them to fall through the world unless they jump first.
I was considering keeping a global list of all players, and after every terrain edit, for every player do a raycast from the sky above him, vertically down to the terrain, then comparing the hit Y position to the players Y position. However I'm unsure if this is scalable if I want to in future check for other objects such as enemies, trees, objects on the ground, etc.
I have read about physics spheres, but the sphere would have to be pretty huge to account for the case of one very low point and another very high point next to it, then the player on the slope between them.
What's the best method of detecting and bumping players back up?
asked Aug 13 '11 at 11:49 PM