Qt Quick 3D Physics API Changes from Tech Preview
Qt Quick 3D Physics API从技术预览更改
Starting with the Qt 6.5.0 release, the Qt Quick 3D Physics module is no longer in Tech Preview. As a result of the API feedback and review process, some source-incompatible changes were made.
从Qt 6.5.0版本开始,Qt Quick 3D Physics模块不再处于技术预览中。由于API的反馈和审查过程,做出了一些源代码兼容的更改。
The majority of the changes are renaming types and properties for consistency with other APIs and to make the names more descriptive. The most noticeable rename is changing DynamicsWorld
to PhysicsWorld, which will affect all applications.
大多数更改是重命名类型和属性,以与其他API保持一致,并使名称更具描述性。最引人注目的重命名是将DynamicsWorld更改为PhysicsWorld,这将影响所有应用程序。
The most important behavioral change is the handling of kinematic bodies. Changing the position/orientation of a kinematic body is no longer done by using the Node properties (position
, rotation
, etc.), but instead by using the new properties: kinematicPosition, kinematicEulerRotation, kinematicRotation, and kinematicPivot. The reason for this change was to make sure that the visual movement of kinematic bodies is synchronized with the rest of the simulation, instead of happening one simulation step too early.
最重要的行为变化是对运动体的处理。更改运动体的位置/方向不再使用节点属性(位置、旋转等),而是使用新属性:kinematicPosition、kinematicEulerRotation、kinematicRotation和kinematicPivot。这一变化的原因是确保运动体的视觉运动与模拟的其余部分同步,而不是过早地进行一个模拟步骤。
The DynamicRigidBody.density property no longer treats negative values (and zero) as a special case. Instead, there are two new massMode enumeration values replacing Density
:
DynamicRigidBody.density属性不再将负值(和零)视为特殊情况。相反,有两个新的massMode枚举值取代了Density:
DefaultDensity | The density of the body is defined by PhysicsWorld.defaultDensity. This is the default. 物体的密度由PhysicsWorld.defaultDensity定义。这是默认设置。 |
CustomDensity | The density of the body is defined by the density property. 物体的密度由密度属性定义。 |
The enableTriggerReports
property has been renamed to sendTriggerReports. In addition, physics objects can now be notified when they enter a trigger body by setting receiveTriggerReports.
enableTriggerReports属性已重命名为sendTriggerReportes。此外,通过设置receiveTriggerReports,物理对象现在可以在进入触发器体时收到通知。
The following is a complete list of all the API changes:
以下是所有API更改的完整列表:
- CollisionShape:
- renamed enableDebugView to enableDebugDraw
- 重命名enableDebugView以启用DebugDraw
- Renamed the abstract base type
CollisionNode
to PhysicsNode- changed enableTriggerReports to sendTriggerReports and receiveTriggerReports
- 已将enableTriggerReports更改为发送和接收触发器报告
- CharacterController
- renamed
speed
to movement
- renamed
- ConvexMeshShape
- renamed
meshSource
to source
- renamed
- HeightFieldShape
- renamed
heightMap
to source
- renamed
- TriangleMeshShape
- renamed
meshSource
to source
- renamed
- PhysicsWorld (renamed from
DynamicsWorld
)- renamed
forceDebugView
to forceDebugDraw - renamed
minTimestep
/maxTimestep
to minimumTimestep/maximumTimestep - removed sceneNode
- added scene
- added viewport
- renamed
- DynamicRigidBody
- changed the
axisLockLinearX/Y/Z
properties into a single property linearAxisLock that takes a bitfield - 将axisLockLinearX/Y/Z属性更改为单个属性linearXisLock,该属性接受一个位字段
- changed the
axisLockAngularX/Y/Z
properties into a single property angularAxisLock that takes a bitfield - 将axisLockAngularX/Y/Z属性更改为接受位字段的单个属性angularAxisLock
- added new properties kinematicPosition, kinematicEulerRotation, kinematicRotation, and kinematicPivot
- 添加了新的属性kinematicPosition、kinematicEulerRotation、kinematicRotation和kinematicPivot
- changed
Density
enum value to DefaultDensity/CustomDensity and removed special-casing of negative values. - 将“密度”枚举值更改为“默认密度/自定义密度”,并删除了负值的特殊大小写。
- replaced the
linearVelocity
property with the method setLinearVelocity. - 将stringVelocity属性以及该方法与LinearVelocity一起替换。
- replaced the
angularVelocity
property with the method setAngularVelocity. - 将“沿角速度”属性与“angularVelocity”方法一起替换。
- changed the