A collision shape where the elevation is defined by a height map. 更多...
import 语句: | import QtQuick3D.Physics |
Since: | Qt 6.4 |
继承: | CollisionShape |
The HeightFieldShape type defines a physical surface where the height is determined by the value of the pixels of the source image. The x-axis of the image is mapped to the positive x-axis of the scene, and the y-axis of the image is mapped to the negative z-axis of the scene. A typical use case is to represent natural terrain.
Objects that are controlled by the physics simulation cannot use HeightFieldShape: It can only be used with StaticRigidBody and kinematic bodies .
QtQuick3D.Helpers.HeightFieldGeometry is API compatible with the HeightFieldShape type, and can be used to show the height field visually. To improve performance, use a lower resolution version of the height map for the HeightFieldShape: As long as the extents and the image aspect ratio are the same, the physics body and the visual item will overlap.
另请参阅 Shapes and Bodies overview documentation .
extents : vector3d |
This property defines the extents of the height field. The default value is
(100, 100, 100)
when the heightMap is square. If the heightMap is non-square, the default value is reduced along the x- or z-axis, so the height field will keep the aspect ratio of the image.
source : url |
This property defines the location of the heightMap file.
在内部, HeightFieldShape converts the height map image to an optimized data structure. This conversion can be done in advance. See the cooking overview documentation 了解细节。