HeightFieldShape QML Type
一种碰撞形状,其高程由高度图定义。更多...
| Import Statement: | import QtQuick3D.Physics |
| Since: | Qt 6.4 |
| Inherits: |
属性
详细说明
HeightFieldShape 类型定义了一种物理表面,其高度由source 图像中像素的value 值决定。图像的 x 轴映射到场景的正 x 轴,图像的 y 轴映射到场景的负 z 轴。典型的应用场景是表现自然地形。
受物理模拟控制的对象不能使用 HeightFieldShape:它仅可与StaticRigidBody 和kinematic bodies 配合使用。
QtQuick3D.Helpers.HeightFieldGeometry 该 API 与 `HeightFieldShape` 类型兼容,可用于直观展示高度场。为提高性能,请为 `HeightFieldShape` 使用分辨率较低的高程图:只要 `extents ` 与图像的宽高比相同,物理体与视觉项就会重叠。
另请参阅 Qt Quick 3D 物理形状、刚体和关节。
属性文档
extents : vector3d
该属性定义了高度字段的范围。当 heightMap 为正方形时,默认值为(100, 100, 100) 。如果 heightMap 不是正方形,则默认值会沿 x 轴或 z 轴缩小,以便高度字段保持图像的宽高比。
image : Image [since 6.7]
该属性定义了存储高度图的图像。
在内部,HeightFieldShape 会将高度图图像转换为一种优化的数据结构。此转换可提前完成。详情请参阅“预处理”概述文档。
注意:如果 同时设置了 image 和source 属性,则仅使用 image。
该属性在 Qt 6.7 中引入。
另请参阅 HeightFieldShape::source 。
source : url
该属性用于指定 heightMap 文件的位置。
在内部,HeightFieldShape 会将高度图图像转换为一种优化的数据结构。此转换可预先完成。详情请参阅“预处理概述”文档。
另请参阅 HeightFieldShape::image 。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.