
°trackballer
MIT License | Copyright © 2022 dofdev
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
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
held.angularVel = Angular(heldRotDelta) / deltaTime
∮