Qt Quick 3D物理单位

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厘米。为了与Qt Quick 3D兼容,内置几何形状的默认尺寸为100厘米。默认重力为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:

使用自定义单位是可能的,但您需要确保所有相关属性都相应地更新。下表显示了以米和厘米为单位的某些属性的等效值:

PropertyValue (cm)Value (m)
gravity9819.81
typicalLength1001
typicalSpeed100010
density0.0011000

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的倍数进行缩放。

Shapes and BodiesCooking

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值