summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/simple-qml
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2015-12-06 14:59:27 +0000
committerSean Harmer <sean.harmer@kdab.com>2015-12-07 19:07:33 +0000
commit933d17e21ad28558fbe45fa8ec85491db18a5356 (patch)
treeaa05a70751e1909bccf7554558810e19caacfb0d /examples/qt3d/simple-qml
parent8e585245bc1cb5a35269e7b5210b13a34ed886d3 (diff)
Update simple-qml to use correct time delta
Change-Id: Idc2d544d242c552033ad4826fad7a2fd48bf9672 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'examples/qt3d/simple-qml')
-rw-r--r--examples/qt3d/simple-qml/CameraController.qml15
1 files changed, 5 insertions, 10 deletions
diff --git a/examples/qt3d/simple-qml/CameraController.qml b/examples/qt3d/simple-qml/CameraController.qml
index f3d1b5739..0bfda31fb 100644
--- a/examples/qt3d/simple-qml/CameraController.qml
+++ b/examples/qt3d/simple-qml/CameraController.qml
@@ -43,9 +43,9 @@ import QtQml 2.2
Entity {
id: root
property Camera camera
- property real linearSpeed: 5.0
- property real orbitSpeed: -2.0
- property real lookSpeed: 2.0
+ property real linearSpeed: 10.0
+ property real orbitSpeed: -180.0
+ property real lookSpeed: 180.0
property bool firstPersonMode: true
QtObject {
@@ -259,14 +259,11 @@ Entity {
},
LogicComponent {
-
onFrameUpdate: {
-
- // TO DO: We would need the time delta since the last call
- var dt = 0.1
+ // The time difference since the last frame is passed in as the
+ // argument dt. It is a floating point value in units of seconds.
root.camera.translate(Qt.vector3d(d.vx, d.vy, d.vz).times(dt))
- dt = 2
if (d.leftMouseButtonPressed) {
if (root.firstPersonMode)
root.camera.pan(root.lookSpeed * d.dx * dt, d.firstPersonUp)
@@ -280,8 +277,6 @@ Entity {
root.camera.panAboutViewCenter(root.lookSpeed * d.dx * dt)
root.camera.tiltAboutViewCenter(root.orbitSpeed * d.dy * dt)
}
-
-
}
}
] // components