File: RemoveCollisionShapes.qml

package info (click to toggle)
qt6-quick3dphysics 6.10.2-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 22,100 kB
  • sloc: cpp: 261,273; python: 40; makefile: 21
file content (79 lines) | stat: -rw-r--r-- 1,636 bytes parent folder | download | duplicates (3)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import QtQuick
import QtQuick3D
import QtQuick3D.Physics
import QtQuick3D.Helpers

Rectangle {
    width: 640
    height: 480
    visible: true

    PhysicsWorld {
        scene: viewport.scene
        forceDebugDraw: true
        running: true
    }

    View3D {
        id: viewport
        anchors.fill: parent

        PerspectiveCamera {
            id: camera
            position: Qt.vector3d(0, 50, 500)
            eulerRotation: Qt.vector3d(0, 0, 0)
            clipFar: 5000
            clipNear: 1
        }

        DirectionalLight {}

        BoxShape {
            id: boxshape
        }
        SphereShape {
            id: sphereshape
        }
        CapsuleShape {
            id: capsuleshape
        }

        StaticRigidBody {
            id: body0
            position: Qt.vector3d(0, 50, 0)
            collisionShapes: [boxshape, sphereshape]
        }

        StaticRigidBody {
            id: body1
            position: Qt.vector3d(0, 150, 0)
            collisionShapes: [sphereshape, boxshape]
        }

        StaticRigidBody {
            id: body2
            position: Qt.vector3d(0, 250, 0)
            collisionShapes: [capsuleshape, sphereshape]
        }

        StaticRigidBody {
            eulerRotation: Qt.vector3d(-90, 0, 0)
            collisionShapes: PlaneShape {}
        }
    }

    WasdController {
        controlledObject: camera
    }

    Timer {
        interval: 1
        running: true
        repeat: false
        onTriggered: {
            body0.collisionShapes.pop()
            body1.collisionShapes.pop()
            body2.collisionShapes.pop()
        }
    }
}