Skip to content
Snippets Groups Projects
Commit d2904ff4 authored by lukasWoyke's avatar lukasWoyke
Browse files

Fixed reverse controlling.

parent 962e8a75
Branches
No related tags found
3 merge requests!62Fix master,!60Code cleanup lukas fix,!57Hot fix gyroscope
...@@ -105,7 +105,7 @@ class GameGyroscopeController { ...@@ -105,7 +105,7 @@ class GameGyroscopeController {
/// Caclulates the vector for controlling the character, by using the input /// Caclulates the vector for controlling the character, by using the input
private func calculateAccVector(newAcc: SIMD3<Double>) -> CGVector { private func calculateAccVector(newAcc: SIMD3<Double>) -> CGVector {
checkReorientation() // checkReorientation()
// Sets the initial position, with the first reading attempt. // Sets the initial position, with the first reading attempt.
if resetOrientationActive { if resetOrientationActive {
initialZ = newAcc.z initialZ = newAcc.z
...@@ -119,7 +119,7 @@ class GameGyroscopeController { ...@@ -119,7 +119,7 @@ class GameGyroscopeController {
var dy = newAcc.x - initialX var dy = newAcc.x - initialX
// Adjust movement when user olds device in LandscapeRight orientation. // Adjust movement when user olds device in LandscapeRight orientation.
if newAcc.x > 0 { if UIDevice.current.orientation == .landscapeLeft {
dx *= (-1) dx *= (-1)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment