HeightFieldShape QML Type

碰撞形状,其高程由高度图定义。更多

Import Statement: import QtQuick3D.Physics
Since: Qt 6.4
Inherits:

CollisionShape

属性

详细说明

value HeightFieldShape 类型定义了一个物理表面,其高度由source 图像的像素决定。图像的 x 轴映射到场景的正 x 轴,图像的 y 轴映射到场景的负 z 轴。典型的使用案例是表现自然地形。

由物理模拟控制的对象不能使用 HeightFieldShape:它只能与StaticRigidBodykinematic bodies 一起使用。

QtQuick3D.Helpers.HeightFieldGeometry HeightFieldShape "是与 HeightFieldShape 类型兼容的 API,可用于直观地显示高度场。为提高性能,请为 HeightFieldShape 使用分辨率较低的高度图:只要 和图像纵横比相同,物理实体和可视项目就会重叠。extents

另请参阅 形状和主体概述文档

属性文档

extents : vector3d

此属性定义了高度区域的范围。当 heightMap 为正方形时,默认值为(100, 100, 100) 。如果 heightMap 不是正方形,默认值会沿 x 轴或 z 轴缩小,因此高度字段将保持图像的纵横比。


image : Image [since 6.7]

该属性定义了持有 heightMap 的图像。

在内部,HeightFieldShape 会将高度图图像转换为优化的数据结构。这种转换可以提前完成。详情请查看烹饪概述文档

注意: 如果同时设置了 image 和source 属性,则只会使用 image。

此属性在 Qt 6.7 中引入。

另请参阅 HeightFieldShape::source


source : url

该属性定义了 heightMap 文件的位置。

在内部,HeightFieldShape 会将高度贴图图像转换为优化的数据结构。这种转换可以提前完成。详情请参见烹饪概述文档

注意: 如果同时设置了image 和 source 属性,则只会使用image

另请参阅 HeightFieldShape::image


© 2025 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.