pico wrote:
Does 'btHeightfieldTerrainShape' recognize when the initial flat mesh gets changed? Or is it needed to force somehow a recalculation of the AABB?
Yes, it should automatically support deformation. You can pass in the maximum height for the terrain/heightfield in the constructor. Just make it big enough, so the AABB get initialized conservatively/large enough at the start.
Code:
btHeightfieldTerrainShape(int width,int height,void* heightfieldData, btScalar maxHeight,int upAxis,bool useFloatData,bool flipQuadEdges);
The btBvhTriangleMeshShape has support for deformation, using the 'refit' or 'refitPartial' methods. You need to pass in the AABB that includes the maximum deformation:
Code:
///optionally pass in a larger bvh aabb, used for quantization. This allows for deformations within this aabb
btBvhTriangleMeshShape(btStridingMeshInterface* meshInterface, bool useQuantizedAabbCompression,const btVector3& bvhAabbMin,const btVector3& bvhAabbMax, bool buildBvh = true);
You can run the ConcaveDemo and press 'g' to see the deformation.
Quote:
Another 'off topic' question: When creating a 'new btRigidBody'. Can the initial transform.basis contain a scale+rotation or only a rotational matrix?
The rigidbody world transform should not have any scaling. If you want to use scaling, you have to scale the collision shape. Non-uniform (not the same in all directions) local scaling is supported for most collision shapes. Otherwise you can use uniform scaling of collision shapes. See also the btCollisionShape::setLocalScaling method. You can also re-use the child collision shape to reduce memory using the btUniformScalingShape.
Hope this helps,
Erwin