Two Question about btHeightfieldTerrainShape

Post Reply
kcjsend2
Posts: 15
Joined: Wed Jun 30, 2021 9:10 am

Two Question about btHeightfieldTerrainShape

Post 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?
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Two Question about btHeightfieldTerrainShape

Post 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.
Post Reply