# Physics Simulation Forum

 All times are UTC

 Page 1 of 1 [ 3 posts ]
 Print view Previous topic | Next topic
Author Message
 Posted: Tue Feb 23, 2016 4:33 am

Joined: Sun Jul 05, 2015 12:55 am
Posts: 16
I have been trying to understand how the btHeightfieldTerrainShape works. I think my main problem is I don't understand what coordinate space the various input and output elements are in.

I am using the following constructor:

Code:
btHeightfieldTerrainShape::btHeightfieldTerrainShape   (   int    heightStickWidth,
int    heightStickLength,
const void *    heightfieldData,
btScalar    heightScale,
btScalar    minHeight,
btScalar    maxHeight,
int    upAxis,
PHY_ScalarType    heightDataType,
)

I read the following note from: http://www.bulletphysics.com/Bullet/Bul ... Shape.html

Quote:
NOTE: be careful with coordinates. If you have a heightfield with a local min height of -100m, and a max height of +500m, you may be tempted to place it at the origin (0,0) and expect the heights in world coordinates to be -100 to +500 meters. Actually, the heights will be -300 to +300m, because bullet will re-center the heightfield based on its AABB (which is determined by the min/max heights). So keep in mind that once you create a btHeightfieldTerrainShape object, the heights will be adjusted relative to the center of the AABB.

Really? Then how come when I pass larger or smaller values into the minHeight/maxHeight parameters of the constructor, it changes the bounding box but seems to have no effect on where the actual collision boundary is created? For example, I created a btHeightfieldTerrainShape, I used the float data type and passed in an array of floats all with value 0.7. I tried various min and max heights (-5 and 2), (0.6 and 0.8 ), even (0.4 to 0.6 which doesn't even contain 0.7) and the objects in my scene still collided at the exact same location (I had a graphical object drawn at 0.7 units above the ground to inspect).

So... what exactly is this 're-centering' doing? And for the 2d array of height values being passed in.. what space should they be in? So in the example described above (where it gets recentered from (-100,500) to (-300,300).. do I pass in height values within the (-100,500) range or within the (-300,300) range?

Any help in understanding this would be much appreciated.

Top

 Posted: Fri Feb 26, 2016 9:24 pm

Joined: Sun Jul 05, 2015 12:55 am
Posts: 16
Is there any more information I could give that would allow someone to better answer my question?

Top

 Posted: Sat Feb 27, 2016 12:18 pm

Joined: Sun Jan 03, 2016 4:22 pm
Posts: 15
I'm not sure what you would like to do differently?

We find the min and max heights, then position the shape at the center location between the two extremes.
Just offset your heightfield data to start with (when generating or importing) if you want everything non-zero origin.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 3 posts ]

 All times are UTC

#### Who is online

Users browsing this forum: Baidu [Spider], Yahoo [Bot] and 17 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ BULLET PHYSICS LIBRARY USERS    General Bullet Physics Support and Feedback    Release Announcements    Applications, Games, Demos or Movies using Bullet PHYSICS AUTHORING TOOLS, SERIALIZATION AND STANDARDS    Physics authoring tools, serialization, standards and related topics RESEARCH AND DEVELOPMENT IN COLLISION DETECTION & PHYSICS. Don't post Bullet support questions here!    Research and development discussion about Collision Detection and Physics Simulation    Links, Papers, Libraries, Demos, Movies, Comparisons       Non-technical forum and license/patent discussion    Career Opportunities