Page 1 of 1

Two Question about btHeightfieldTerrainShape

Posted: Wed Jun 30, 2021 9:25 am
by kcjsend2
first, I've searched about btHeightfieldTerrainShape, and then i realized that constructor doesn't need any normal data. is it compute normal itself by terrain height - index data?

second, is there any kind of form about parameter void* heightfieldData? I know that must be heightDataType - array, but there must be x - z coordinates or something, but only it gets are just array. is there any formula for this?

Re: Two Question about btHeightfieldTerrainShape

Posted: Thu Jul 01, 2021 2:26 pm
by drleviathan
(1) The btHeightfieldTerrainShape uses its data to compute triangles. The normals are properties of the triangles and are computed as needed.

(2) The btHeightfieldTerrainShape::m_heightfieldDataFloat member variable is understood to be a regular 2D rectangular array of heights along one of the cardinal axes (as specified by the btHeightfieldTerrainShape::m_upAxis member variable). The other two components of a vertex on the heightfield are computed using the corresponding 2D index into the array combined with the btHeightfieldTerrainShape::m_width, m_height, and m_heightScale member variables.