Qt Quick 3D Physics Units
Qt Quick 3D物理单元
When simulating physical objects you need to define a common frame of reference for all physical units. In Qt Quick 3D Physics all types are unit-less meaning you can define your world in centimeters, meters, inches or whatever you prefer as long as you are consistent. The important part is that all values used are based on the same units.
当模拟物理对象时,需要为所有物理单元定义一个公共参考框架。在Qt Quick 3D Physics中,所有类型都是无单位的,这意味着你可以用厘米、米、英寸或任何你喜欢的单位来定义你的世界,只要你是一致的。重要的是,所有使用的值都基于相同的单位。
Default units
默认单位
Despite the module being unit-less all physical properties have default values that are based on centimeters. This means that adding a sphere with diameter 1
would make it behave like it was 1
cm in diameter. To be compatible with Qt Quick 3D the default sizes of the built-in geometries are 100
cm. The default gravity is 981
which matches the gravity on earth in cm per square-second. The default density is 0.001
kilograms per cubic-centimeters i.e. 1000
kilogram per cubic-meter which is the density of fresh water at 4
°C.
尽管模块的单位较少,但所有物理特性都具有基于厘米的默认值。这意味着添加一个直径为1的球体将使其表现为直径为1 cm。为了与Qt Quick 3D兼容,内置几何图形的默认尺寸为100 cm。默认重力为981,与地球上的重力(厘米/平方秒)相匹配。默认密度为0.001千克/立方厘米,即1000千克/立方米,即4°C时淡水的密度。
Custom units
自定义单位
Using custom units is possible but you need to make sure all relevant properties are updated accordingly. Below is a table showing the equivalent values of some properties in both a meter and a centimeter based scale:
可以使用自定义单位,但需要确保所有相关属性都相应更新。下表以米和厘米为单位显示了一些特性的等效值:
Property 属性 | Value (cm) 数值(cm) | Value (m) 数值(m) |
---|---|---|
重力 | 981 | 9.81 |
标准长度 | 100 | 1 |
标准速度 | 1000 | 10 |
密度 | 0.001 | 1000 |
If converting from a centimeter to a meter based scale then all the positions and dimensions of objects as well as impulses and forces would need to be scaled by a factor of 0.01
.
如果从一厘米换算为以米为单位的比例,那么物体的所有位置和尺寸以及冲量和力都需要按0.01的系数进行换算。
© 2022 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.