1 | // Copyright (C) 2021 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #include "qabstractphysicsbody_p.h" |
5 | |
6 | QT_BEGIN_NAMESPACE |
7 | |
8 | /*! |
9 | \qmltype PhysicsBody |
10 | \inherits PhysicsNode |
11 | \inqmlmodule QtQuick3D.Physics |
12 | \since 6.4 |
13 | \brief Base type for all concrete physical bodies. |
14 | |
15 | PhysicsBody is the base type for all objects that have a physical presence. These objects |
16 | interact with other bodies. Some types are not influenced by the simulation, such as |
17 | StaticRigidBody: They only influence other bodies. Other bodies are fully governed by the |
18 | simulation. |
19 | |
20 | \sa {Qt Quick 3D Physics Shapes and Bodies}{Shapes and Bodies overview documentation} |
21 | */ |
22 | |
23 | /*! |
24 | \qmlproperty PhysicsMaterial PhysicsBody::physicsMaterial |
25 | This property defines how the body behaves when it collides with or slides against other bodies in the simulation. |
26 | */ |
27 | |
28 | QAbstractPhysicsBody::QAbstractPhysicsBody() |
29 | { |
30 | m_physicsMaterial = new QPhysicsMaterial(this); |
31 | } |
32 | |
33 | QPhysicsMaterial *QAbstractPhysicsBody::physicsMaterial() const |
34 | { |
35 | return m_physicsMaterial; |
36 | } |
37 | |
38 | void QAbstractPhysicsBody::setPhysicsMaterial(QPhysicsMaterial *newPhysicsMaterial) |
39 | { |
40 | if (m_physicsMaterial == newPhysicsMaterial) |
41 | return; |
42 | m_physicsMaterial = newPhysicsMaterial; |
43 | emit physicsMaterialChanged(); |
44 | } |
45 | |
46 | QT_END_NAMESPACE |
47 |