Qt Quick 3D 物理单位
在模拟物理对象时,您需要为所有物理单位定义一个共同的参考系。在Qt Quick 3D 物理引擎中,所有类型都是无量纲的,这意味着您可以使用厘米、米、英寸或任何您喜欢的单位来定义您的世界,只要保持一致即可。关键在于,所使用的所有值都基于相同的单位。
默认单位
尽管该模块是无量纲的,但所有物理属性都有基于厘米的默认值。这意味着,添加一个直径为1 的球体,其行为将等同于直径为1 厘米的球体。为了与Qt Quick 3D 兼容,内置几何体的默认尺寸为100 厘米。默认重力为981 ,该值以厘米每平方秒为单位,与地球上的重力一致。 默认密度为0.001 千克/立方厘米,即1000 千克/立方米,这是淡水在4 °C时的密度。
自定义单位
可以使用自定义单位,但需确保所有相关属性均相应更新。下表展示了某些属性在以米和厘米为基准的量表中的等效值:
| 属性 | 值(cm) | 值 (m) |
|---|---|---|
| gravity | 981 | 9.81 |
| typicalLength | 100 | 1 |
| typicalSpeed | 1000 | 10 |
| density | 0.001 | 1000 |
若从厘米制单位换算为米制单位,则所有物体的位置和尺寸以及冲量和力都需要按0.01 的倍数进行缩放。
© 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.