Qt Quick 3D 物理 API 相较于技术预览版的变更

从 Qt 6.5.0 版本开始,Qt Quick 3D 物理模块不再处于技术预览阶段。基于对 API 的反馈和审查流程,我们进行了一些源代码不兼容的更改。

大部分更改是重命名类型和属性,以与其他 API 保持一致,并使名称更具描述性。最显著的重命名是将DynamicsWorld 更改为PhysicsWorld ,这将影响所有应用程序。

最重要的行为变更在于对 `kinematic bodies` 的处理方式。调整运动学体的位置/方向不再通过 `Node ` 属性(如 `position`、`rotation` 等)实现,而是改用以下新属性:kinematicPosition 、kinematicEulerRotation 、kinematicRotation 以及kinematicPivot 。 进行此更改的目的是确保运动学体的视觉移动与模拟的其余部分保持同步,而不是提前一个模拟步发生。

DynamicRigidBody.density 属性不再将负值(和零)视为特例。取而代之的是,有两个新的massMode 枚举值取代了Density :

DefaultDensity物体的密度由PhysicsWorld.defaultDensity 属性定义。这是默认设置。
CustomDensity物体的密度由density 属性定义。

enableTriggerReports 属性已重命名为sendTriggerReports 。此外,现在可以通过设置receiveTriggerReports 来通知物理对象其已进入触发体。

以下是所有 API 变更的完整列表:

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