createHeightFieldShape clarification #372
Replies: 1 comment
-
After further testing I'm starting to see that the issue is related to down-scaling height maps. The assert I'm often hitting is: I think the issue I'm having is that I'm trying to shrink a height map down to too small of a world size, so there's lots of detail in the height map shape, and when objects collide with the shape it's throwing an assert because there's too high of a density of height map points that it's colliding with? I'm trying to use a roughly 1000x1000 height map and scale it down to a size of 100x100 in world units, which seems reasonable, but it doesn't seem to like it and asserts. If I modify the same code to instead use a 5x5, 10x10 or 100x100 height map, and scale each to the same 100x100 world size, it seems to work OK without asserts. Only when I have a higher detail of height map that I'm scaling down does it start throwing asserts. Am I on the right path here? Anything that I can do to tweak/fix this? |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm trying to create a HeightField collision shape and I'm struggling to get it working and I was hoping to get some clarification on how to set some parameters.
1) Scaling
There's an undocumented "scaling" parameter on the createHeightFieldShape function and I'm trying to use that to scale the height map's data's dimensions down to the world size bounds I want the height map shape to occupy. Is that the correct usage of this parameter?
For example, if I'm creating a height map shape oriented in the X/Z plane, height mapped into Y, and I have 1000x1000 height map data points, put into a 1000 * 1000 element array for input to createHeightFieldShape, and I want the final height map shape's bounds to occupy a 100x100 (x/z) area in world space, I'm passing in all 1000x1000 data points when creating the height map shape, and trying to specify a scaling factor of {0.1, 1.0, 0.1} to shrink the x/z size down to the proper world size. Is this what that parameter is intended for? If not, how should I accomplish this scaling?
(When I attempt to do the above it doesn't seem happy when an object collides with the height map shape; either simulation steps take a horribly long time to run, or it triggers asserts about manifold contact point counts, depending on which minHeight/maxHeight values I provided).
2) Min/Max values
What exactly are the minHeight/maxHeight values passed into createHeightFieldShape supposed to represent? Are they strictly supposed to contain the specific min/max values of all the data points passed in? As in, just loop over all data points and keep track of min/max, and that's it, or do they represent something else?
Thanks for the help!
Beta Was this translation helpful? Give feedback.
All reactions