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.
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.
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:
特性 | Value (cm) | Value (m) |
---|---|---|
gravity |
981
|
9.81
|
typicalLength |
100
|
1
|
typicalSpeed |
1000
|
10
|
density |
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
.