btHeightfieldTerrainShape constructor-how to specify width?

thegeneralsolution
Posts: 16
Joined: Sun Jul 05, 2015 12:55 am

btHeightfieldTerrainShape constructor-how to specify width?

Post by thegeneralsolution »

So this is the constructor I am using:

Code: Select all

btHeightfieldTerrainShape::btHeightfieldTerrainShape	(	int 	heightStickWidth,
int 	heightStickLength,
const void * 	heightfieldData,
btScalar 	heightScale,
btScalar 	minHeight,
btScalar 	maxHeight,
int 	upAxis,
PHY_ScalarType 	heightDataType,
bool 	flipQuadEdges 
)	
To my understanding, heigthStickWidth, and heightStickLength tell bullet about the size of the heightfieldData array that is passed in.

But what determines the actual length and width of the terrain itself? Does it assume its a square with vertices (-1,-1),(1,-1),(1,1),(1,-1) and then apply the local scaling?
Xammond
Posts: 15
Joined: Sun Jan 03, 2016 4:22 pm

Re: btHeightfieldTerrainShape constructor-how to specify wid

Post by Xammond »

1 unit would equate to 1m * local scaling. So the heightfield will be the size of your width/length * local scaling. The 'square' that you mention is incorrect and would actually cover 2x2 1m scaled grid slots made from 9 heights, or 1x1 2m scaled from 4 heights.

x-x-x
| | |
x-x-x
| | |
x-x-x

or

x---x
| |
| |
| |
x---x

erm :D