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 更改的完整列表:
- CollisionShape:
- 将 enableDebugView 更名为enableDebugDraw
- 将抽象基本类型
CollisionNode
更名为PhysicsNode- 将 enableTriggerReports 更改为sendTriggerReports 和receiveTriggerReports
- CharacterController
- 更名为
speed
movement
- 更名为
- ConvexMeshShape
- 将
meshSource
更改为source
- 将
- HeightFieldShape
- 将
heightMap
更改为source
- 将
- TriangleMeshShape
- 将
meshSource
更改为source
- 将
- PhysicsWorld (由 重命名 )
DynamicsWorld
- 将
forceDebugView
更名为forceDebugDraw - 将
minTimestep
/maxTimestep
重命名为minimumTimestep/。maximumTimestep - 删除了 sceneNode
- 已添加scene
- 已添加viewport
- 将
- DynamicRigidBody
- 将
axisLockLinearX/Y/Z
属性改为单一属性linearAxisLock ,该属性接收一个位字段 - 将
axisLockAngularX/Y/Z
属性更改为单个占用位字段的属性angularAxisLock - 添加了新属性kinematicPosition,kinematicEulerRotation,kinematicRotation, 和kinematicPivot
- 将
Density
枚举值改为DefaultDensity/CustomDensity ,并删除了负值的特殊大小写。 - 用setLinearVelocity 方法替换了
linearVelocity
属性。 - 用setAngularVelocity 方法替换了
angularVelocity
属性。
- 将
© 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.