pattern of behaviour

This commit is contained in:
ethan merchant 2023-02-16 04:26:59 -05:00
parent 54d72a1fa7
commit e2d928eaee
17 changed files with 138 additions and 1 deletions

View file

@ -0,0 +1,27 @@
# 2021.10.18 -> 2023.02.16 ->
// 4 independent spatial cursors
p0 = leftHand.pos
p1 = leftTwistCursor.pos
p2 = rightTwistCursor.pos
p3 = rightHand.pos
if toggle
if !leftTwistCursor.outty
pp = p0
p0 = p1
p1 = pp
if !rightTwistCursor.outty
pp = p2
p2 = p3
p3 = pp
pastPos = p0
for i = 0, i < 64, i++
t = i / 63.0f
a = Lerp(p0, p1, t)
b = Lerp(p1, p2, t)
c = Lerp(p2, p3, t)
pos = Lerp(Lerp(a, b, t), Lerp(b, c, t), t)
Draw.Line(pastPos, pos, color)
pastPos = pos

View file

@ -0,0 +1,5 @@
# 2019.11.03 -> 2023.02.16 ->
rot = (stick.y * 90, 0, stick.x * 90)
dir = stick.pressed ? down : up
output = hand.rotation * rot * dir

View file

@ -0,0 +1,24 @@
# 2019.10.28 -> 2023.02.16 ->
dragPos = mainHand.pos
if (mainHand.button.down)
lastPos = dragPos
if (mainHand.button.held)
cursor += (dragPos - lastPos) * 12
lastPos = dragPos
// x orbital-view
dragPos = mainHand.pos // * head.rot
newRot = orielRot * head.rot
if (mainHand.button.down)
lastPos = dragPos
if (mainHand.button.held)
cursor += newRot * ((dragPos - lastPos) * 12)
cursor = newRot * rot.inverse(oldRot) * cursor
lastPos = dragPos
oldRot = newRot

View file

@ -0,0 +1,8 @@
# 2019.10.17 -> 2023.02.16 ->
oriel.pos = head.rot * fwd
// amplified
oriel.pos = head.rot * fwd
strength = ~4
oriel.rot = rot.euler(0, head.euler.y * -strength, 0)

View file

@ -41,4 +41,4 @@ data
frame
design
design

View file

@ -0,0 +1,8 @@
# 2021.10.15 -> 2023.02.16 ->
a = offHand.pos
hit = raycast(offHand.fwd, midPlane)
dist = distance(hit, midPlane)
b = mainHand.pos + mainHand.rot * fwd * dist
c = backhanded stretch-cursor
pos = lerp(lerp(a, b, t), lerp(b, c, t), t)

View file

@ -0,0 +1,30 @@
# 2021.10.29 -> 2023.02.16 ->
# gyro-keyboard
# tilt through the layers as you type, reducing travel and mistaps
keyLayers[3]
tilt = device.rotation.y
index = int(tilt * 10)
layer = keyLayers[index]
if tap
layer.sample(touch.pos)
# swipe-cursor
# extend cursor out of phone with swipe
if absolute
offset = touch.y
offset += touch.delta.y
cursor = phone.pos + phone.up * offset * 3
# touch-stretch-cursor
# using the distance between your thumbs extend a cursor out
stretch = dist(touch[0], touch[1])
dir = calibration
origin = phone.pos + phone.rot * touch[0].xy
cursor = origin + phone.rot * dir * stretch * 3
# tilt-touch
# tilt your phone to move the touch points in 3d space
touch.xyz = phone.rot * touch.xy

View file

@ -0,0 +1,29 @@
# 2020.04.21 -> 2023.02.16 ->
newRot = hand.rot * heldRot * spinRot
if (offCon.triggerBtn.held && held != null)
newDelta = Inverse(newRot) * offHand.rotDelta
newDelta *= newRot
spinDelta = Slerp(
spinDelta,
newDelta,
Time.deltaTime / 0.1f
)
spinRot *= spinDelta
// lower the speed the higher the friction
friction = 1 - Clamp01(
Angular(spinDelta).magnitude / deltaTime / 15
)
friction = friction * friction * friction;
spinDelta = Slerp(
Quaternion.identity,
spinDelta,
1 - (friction * Time.deltaTime)
)
heldRotDelta = newRot * Inverse(oldRot)
held.rot = hand.rot * heldRot * spinRot
// or
held.angularVel = Angular(heldRotDelta) / deltaTime

View file

@ -0,0 +1,6 @@
# 2021.10.15 -> 2023.02.16 ->
rel = LookRotation(mainHand.rot * forward)
twist = Angle(rel * up, hand.rot * up) / 180
twist = Max(twist - 0.05, 0)
cursor = hand.pos + hand.rot * forward * twist

View file