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 更改的完整列表:

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