Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qabstractphysicsbody.cpp
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
6
8
9/*!
10 \qmltype PhysicsBody
11 \inherits PhysicsNode
12 \inqmlmodule QtQuick3D.Physics
13 \since 6.4
14 \brief Base type for all concrete physical bodies.
15
16 PhysicsBody is the base type for all objects that have a physical presence. These objects
17 interact with other bodies. Some types are not influenced by the simulation, such as
18 StaticRigidBody: They only influence other bodies. Other bodies are fully governed by the
19 simulation.
20
21 \sa {Qt Quick 3D Physics Shapes and Bodies}{Shapes and Bodies overview documentation}
22*/
23
24/*!
25 \qmlproperty PhysicsMaterial PhysicsBody::physicsMaterial
26 This property defines how the body behaves when it collides with or slides against other bodies in the simulation.
27*/
28
29/*!
30 \qmlproperty bool PhysicsBody::simulationEnabled
31 This property defines if the body will partake in the physical simulation.
32
33 Default value: \c{true}
34*/
35
36QAbstractPhysicsBody::QAbstractPhysicsBody()
37{
38 m_physicsMaterial = new QPhysicsMaterial(this);
39}
40
41QPhysicsMaterial *QAbstractPhysicsBody::physicsMaterial() const
42{
43 return m_physicsMaterial;
44}
45
46void QAbstractPhysicsBody::setPhysicsMaterial(QPhysicsMaterial *newPhysicsMaterial)
47{
48 if (m_physicsMaterial == newPhysicsMaterial)
49 return;
50 m_physicsMaterial = newPhysicsMaterial;
51 emit physicsMaterialChanged();
52}
53
54bool QAbstractPhysicsBody::simulationEnabled() const
55{
56 return m_simulationEnabled;
57}
58
59void QAbstractPhysicsBody::setSimulationEnabled(bool newSimulationEnabled)
60{
61 if (m_simulationEnabled == newSimulationEnabled)
62 return;
63 m_simulationEnabled = newSimulationEnabled;
64 emit simulationEnabledChanged();
65}
66
67QT_END_NAMESPACE
Combined button and popup list for selecting options.