greyscale heightmap


Can anyone point me in the direction of a good greyscale/heightmap tutorial? I want to be able to check where a particular actor is on a given greyscale/heightmap floor - and then adjust their z position according to the greyscale factor (i.e. white is high, black is low).

  1. How do i find the value of the pixel (or pixels) that the actor is currently on? (i.e. greyscale value)…
  2. What is the best way to load in the greyscale map?

…if I can get that information, I think I can adjust their Y position…

Thanks in advance!

…just an update - I’m gonna try to study the Roaming Ralp example (might be the closest thing I need)…but any other advice would be appreciated!

also check out PGMM pro-rsoft has done a great job on this!

PGMM is a panda class which can convert a grayscale heightmap into a NodePath. It provides LOD, chunking, selective dynamic updating, and a way to find out the height where the actor is currently on (getElevation).

If you use PGMM, the way to keep the avatar on the terrain is:

taskMgr.add(task,"glue avatar to terrain")
def stickToTerrainTask(task):
  return task.cont