Skip to content

Instantly share code, notes, and snippets.

@ashkitten
Created December 4, 2023 16:48
Show Gist options
  • Save ashkitten/8e0ce8495f51866a60ef73c3ed142ed5 to your computer and use it in GitHub Desktop.
Save ashkitten/8e0ce8495f51866a60ef73c3ed142ed5 to your computer and use it in GitHub Desktop.
if(`Right Trackpad Touch`, (
$yd = (`Right Trackpad Y+` - `Right Trackpad Y-` - $y1) / 0.56 * 0.7,
$xd = (`Right Trackpad X+` - `Right Trackpad X-` - $x1) * 0.7,
if($lastTouch < 1 & $held > 3, (
$yv = ($yv / 4) + ($yd / 4) + ($yd1 / 4) + ($yd2 / 4),
$xv = ($xv / 4) + ($xd / 4) + ($xd1 / 4) + ($xd2 / 4)
), 0),
$yd2 = $yd1,
$xd2 = $xd1,
$yd1 = $yd,
$xd1 = $xd,
$y1 = `Right Trackpad Y+` - `Right Trackpad Y-`,
$x1 = `Right Trackpad X+` - `Right Trackpad X-`,
$lastTouch = 0,
$held = $held + 1
), (
$yv = $yv * 0.95,
$xv = $xv * 0.95,
$lastTouch = $lastTouch + 1,
$held = 0
)),
$y = clamp($y + $yv, -1, 1),
$x = clamp($x + $xv, -1, 1),
## up
# $y / 2 + 0.5
## down
# -$y / 2 + 0.5
## left
# -$x / 2 + 0.5
## right
# $x / 2 + 0.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment