blob: d724e1063db9d5cc872dcec0d018595982797519 (
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
32
33
|
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\example cannon
\ingroup quick3dphysics-examples
\title Qt Quick 3D Physics - Cannon Example
\examplecategory {Data Visualization & 3D}
\brief Demonstrates how to spawn physical objects.
\image cannon-example.jpg
This example demonstrates how to create and delete physical objects on demand.
The scene consists of a number of stacks of boxes.
You can move around by using \c WASD and the mouse and shoot a ball by pressing \c space.
The scene is setup with the usual Qt Quick 3D objects like view, camera and light:
\snippet cannon/main.qml camera
\snippet cannon/main.qml light
We also add a static floor:
\snippet cannon/main.qml floor
We create a Node we use as the spawner of objects and put inside our view:
\snippet cannon/main.qml spawner
We have three methods: \c createStack for creating a stack, \c createBall for creating a ball with velocity and \c reset for resetting the scene.
The actual box and sphere that is spawn is stored in their own qml files (\c box.qml and \c sphere.qml).
*/
|