Probably a daft question.... Units

Units, what are they? lol


…moves the model forward by 20 “units”. What are the units?


The units are whatever you want them to be. It makes no difference in the resulting render regardless of whether the units are femtometres, yards, feet, legs, lightyears, or any unit you just made up. As long as you are consistent, though, and use the same unit for every position and distance you pass to Panda.

Sort of makes sense. But let me try a different angle:

  1. I create a GeoMipTerrain using a 1024x1024px heightmap
  2. Set max height of world to 65 via sZ(). Scale to 1.
  3. Position model on that world.
  4. Move model around in increments of 1 for X/Y/Z

…the model is over the terrain so long as it stays in the 0 to 1024 bounds. Position it at 65 Z and it’s as high as the highest peak on the terrain. 0 lowest point.

So I conclude - the GeoMipTerrain routines translate the 1024 ‘pixel’ map into a 1024 ‘game units’ map… the same units the engine uses for positioning (when I call setPos, it’s using the same ‘game units’)… and I suppose I was looking for a name for them. :slight_smile:


Right, one heightmap pixel translates to one Panda unit. What those pixels represent that’s up to you to decide, you just have to make sure to setScale() on the terrain to compensate.

As for the Z scale: by default, a white pixel on the heightmap image represents a Z value of 1, a black pixel represents a Z value of 0. So you need to make sure that you setSz the terrain accordingly, so that for a normalised heightmap, the setSz represents the maximum altitude difference of the terrain (highestpoint - lowestpoint).

Good answer. :slight_smile:


When using positional audio, Panda defaults to 1 unit = 1 foot for calculating sound falloff. This can be changed, however.