File: Box.qml

package info (click to toggle)
qt6-quick3dphysics 6.8.2-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 22,164 kB
  • sloc: cpp: 261,165; python: 40; makefile: 18
file content (30 lines) | stat: -rw-r--r-- 744 bytes parent folder | download | duplicates (2)
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
// 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 xyzExtents: 1
    massMode: DynamicRigidBody.CustomDensity
    density: 10

    Model {
        source: "#Cube"
        scale: Qt.vector3d(xyzExtents, xyzExtents, xyzExtents).times(0.01)
        materials: PrincipledMaterial {
            baseColor: "red"
        }
    }

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

    collisionShapes: BoxShape {
        extents: Qt.vector3d(xyzExtents, xyzExtents, xyzExtents)
    }
}