From Newton Wiki
Jump to: navigation, search


NewtonCollision* NewtonCreateHeightFieldCollision (const NewtonWorld* const newtonWorld, int width, int height, int gridsDiagonals, int elevationdatType, const void* const elevationMap, const char* const attributeMap, dFloat verticalScale, dFloat horizontalScale_x, dFloat horizontalScale_z, int shapeID)


Creates a height field collision primitive.


  • const NewtonWorld *newtonWorld - is the pointer to the Newton world.
  • int width - the number of columns in the elevation map.
  • int height - the number of rows in the elevation map.
  • int gridsDiagonals - decides whether the quads of the height field are divided into triangles as having a diagonal cut from the lower left vertex to the upper right, or from upper left to the lower right.
  • int elevationdatType
  • unsigned short* elevationMap - the actual elevation map as 16-bit integer array.
  • char *attributeMap - an array of shape IDs associated with the cells of the height field.
  • dFloat verticalScale - the scale factor for denormalizing the height values (the integer values in the elevation map will be scaled by this factor).
  • dFloat horizontalScale_x - the x size of one cell (one quad of the height map).
  • dFloat horizontalScale_z - the z size of one cell (one quad of the height map).
  • int shapeID


  • Pointer to the height field collision primitive.


Creates a height field collision with the specified elevation map and attributes.


  • Added since Newton 2.0
  • Usually a very small value should be used for verticalScale if you have your units in the standard form (1 unit = 1 meter) like e.g. 0.001f if you want your height values to be in the 0.0 - 65.5 range

See also