Skip to content
Snippets Groups Projects
Commit 60ca60de authored by Richard Gustavsen's avatar Richard Gustavsen
Browse files

WasdController: add speed multiplier

...so that you can increase/decrease speed in all directions without
the need to tweak each one individually
parent 5405626b
No related branches found
No related tags found
No related merge requests found
Pipeline #3710 passed
...@@ -2,8 +2,12 @@ ...@@ -2,8 +2,12 @@
import QtDemon 1.0 import QtDemon 1.0
Item { Item {
id: root
property DemonNode controlledObject: undefined property DemonNode controlledObject: undefined
property real speed: 1
property real shiftSpeed: 3
property real forwardSpeed: 5 property real forwardSpeed: 5
property real backSpeed: 5 property real backSpeed: 5
property real rightSpeed: 5 property real rightSpeed: 5
...@@ -12,7 +16,6 @@ Item { ...@@ -12,7 +16,6 @@ Item {
property real downSpeed: 5 property real downSpeed: 5
property real xSpeed: 0.1 property real xSpeed: 0.1
property real ySpeed: 0.1 property real ySpeed: 0.1
property real shiftSpeed: 3
property bool xInvert: false property bool xInvert: false
property bool yInvert: true property bool yInvert: true
...@@ -212,6 +215,8 @@ Item { ...@@ -212,6 +215,8 @@ Item {
{ {
if (shiftDown) if (shiftDown)
speed *= shiftSpeed; speed *= shiftSpeed;
else
speed *= root.speed
var direction = vector; var direction = vector;
var velocity = Qt.vector3d(direction.x * speed, var velocity = Qt.vector3d(direction.x * speed,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment