Qt Quick 3D 物理单位

在模拟物理对象时,您需要为所有物理单位定义一个共同的参照系。在Qt Quick 3D Physics 中,所有类型都是无单位的,也就是说,只要保持一致,您可以用厘米、米、英寸或任何您喜欢的单位来定义您的世界。重要的是,所有使用的值都基于相同的单位。

默认单位

尽管模块是无单位的,但所有物理属性的默认值都以厘米为单位。这意味着,如果添加一个直径为1 的球体,它的直径就会变成1 厘米。为了与Qt Quick 3D 兼容,内置几何体的默认尺寸为100 厘米。默认重力为981 ,与地球重力相匹配,单位为厘米/平方秒。默认密度为0.001 千克每立方厘米,即1000 千克每立方米,这是4 °C 时淡水的密度。

自定义单位

可以使用自定义单位,但需要确保所有相关属性都已相应更新。下表显示了一些属性在米制和厘米制刻度下的等效值:

属性值(厘米)值(米)
gravity9819.81
typicalLength1001
typicalSpeed100010
density0.0011000

如果将厘米刻度转换为米刻度,那么所有物体的位置和尺寸以及脉冲和力都需要按0.01 的系数进行缩放。

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