PhysicsWorld QML Type

Controls the physics simulation. 更多...

import 语句: import QtQuick3D.Physics
Since: Qt 6.4

特性

信号

详细描述

The PhysicsWorld type controls the physics simulation. This node is used to create an instance of the physics world as well as define its properties. There can only be one physics world. All collision nodes in the qml will get added automatically to the physics world.

特性文档编制

defaultDensity : float

This property defines the default density of dynamic objects, measured in kilograms per cubic unit. This is equal to the weight of a cube with side 1 .

默认值为 0.001 , corresponding to 1 g/cm³: the density of water. If your unit of measurement is meters, a good value would be 1000 . Note that only positive values are allowed.

Range: (0, inf]


enableCCD : bool

This property enables continuous collision detection. This will reduce the risk of bodies going through other bodies at high velocities (also known as tunnelling). The default value is false .


forceDebugDraw : bool

This property enables debug drawing of all active shapes in the physics world. The default value is false .


gravity : vector3d

This property defines the gravity vector of the physics world. The default value is (0, -981, 0) . Set the value to Qt.vector3d(0, -9.81, 0) if your unit of measurement is meters and you are simulating Earth gravity.


maximumTimestep : float

This property defines the maximum simulation timestep in milliseconds. The default value is 33.333 which corresponds to 30 frames per second.

Range: [0, inf]


minimumTimestep : float

This property defines the minimum simulation timestep in milliseconds. The default value is 16.667 which corresponds to 60 frames per second.

Range: [0, maximumTimestep]


running : bool

This property starts or stops the physical simulation. The default value is true .


scene : Node

This property defines the top-most Node that contains all the nodes of the physical simulation. All physics objects that are an ancestor of this node will be seen as part of this PhysicsWorld .

注意: Using the same scene node for several PhysicsWorld is unsupported.

typicalLength : float

This property defines the approximate size of objects in the simulation. This is used to estimate certain length-related tolerances. Objects much smaller or much larger than this size may not behave properly. The default value is 100 .

Range: [0, inf]


typicalSpeed : float

This property defines the typical magnitude of velocities of objects in simulation. This is used to estimate whether a contact should be treated as bouncing or resting based on its impact velocity, and a kinetic energy threshold below which the simulation may put objects to sleep.

For normal physical environments, a good choice is the approximate speed of an object falling under gravity for one second. The default value is 1000 .

Range: [0, inf]


viewport : Node

This property defines the viewport where debug components will be drawn if forceDebugDraw is enabled. If unset the scene node will be used.

另请参阅 forceDebugDraw and scene .


信号文档编制

[since 6.5] frameDone ( float timestep )

This signal is emitted when the physical simulation is done simulating a frame. The timestep parameter is how long in milliseconds the timestep was in the simulation.

注意: 相应处理程序是 onFrameDone .

This signal was introduced in Qt 6.5.