aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick3dphysics/mass/Sphere.qml
blob: 2166e6f95cf8caf4f97c687dbf3d455c8d5d5647 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
import QtQuick3D
import QtQuick3D.Physics

DynamicRigidBody {
    property bool inArea: false
    property real sphereDiameter: 2
    massMode: DynamicRigidBody.CustomDensity
    density: 2

    Model {
        source: "#Sphere"
        receivesShadows: false
        scale: Qt.vector3d(1, 1, 1).times(sphereDiameter * 0.01)
        materials: PrincipledMaterial {
            baseColor: "yellow"
        }
    }

    physicsMaterial: PhysicsMaterial {
        restitution: 0.6
        dynamicFriction: 0.5
        staticFriction: 0.5
    }

    collisionShapes: SphereShape {
        diameter: sphereDiameter
    }
}