mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
better touch controls camera
This commit is contained in:
parent
e4c013bec6
commit
c9d8aeda72
1 changed files with 7 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ import gui.GuiControl;
|
|||
import src.MarbleGame;
|
||||
import src.Settings;
|
||||
import touch.TouchInput.TouchEventState;
|
||||
import src.Util;
|
||||
|
||||
class CameraInput {
|
||||
var identifier:Int = -1;
|
||||
|
|
@ -78,7 +79,7 @@ class CameraInput {
|
|||
if (jumpcam) {
|
||||
scaleFactor /= Settings.touchSettings.buttonJoystickMultiplier;
|
||||
}
|
||||
MarbleGame.instance.world.marble.camera.orbit(delta.x / scaleFactor, delta.y / scaleFactor, true);
|
||||
MarbleGame.instance.world.marble.camera.orbit(applyNonlinearScale(delta.x / scaleFactor), applyNonlinearScale(delta.y / scaleFactor), true);
|
||||
prevMouse.x = e.relX;
|
||||
prevMouse.y = e.relY;
|
||||
}
|
||||
|
|
@ -97,6 +98,11 @@ class CameraInput {
|
|||
}
|
||||
}
|
||||
|
||||
function applyNonlinearScale(value:Float) {
|
||||
var clamped = Util.clamp(value, -10, 10);
|
||||
return Math.abs(clamped) < 3 ? Math.pow(Math.abs(clamped / 2), 2.7) * (clamped >= 0 ? 1 : -1) : clamped;
|
||||
}
|
||||
|
||||
// public function update(touchState:TouchEventState, joycam:Bool) {
|
||||
// if (!enabled)
|
||||
// return;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue