From 47ea90e8699ce49c19ec9169dfae053846b0cd0b Mon Sep 17 00:00:00 2001 From: Erimel Date: Thu, 1 Oct 2026 13:50:44 -0400 Subject: [PATCH] Fix velocity axes --- .../src/main/java/dev/slimevr/solarxr/driver/incoming.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/core/src/main/java/dev/slimevr/solarxr/driver/incoming.kt b/server/core/src/main/java/dev/slimevr/solarxr/driver/incoming.kt index f22622e9f..f73c9804b 100644 --- a/server/core/src/main/java/dev/slimevr/solarxr/driver/incoming.kt +++ b/server/core/src/main/java/dev/slimevr/solarxr/driver/incoming.kt @@ -48,6 +48,9 @@ private val BODY_PART_TO_OFFSET = mapOf( BodyPart.RIGHT_HAND to Offset(indexBoneOffset.unaryMinusX(), indexRotX * indexRotZ.inv()), ) +// I don't know why linear velocity seems to be in a different coordinate system. -Erimel +private fun remapVelocity(velocity: Vector3) = Vector3(velocity.z, -velocity.y, velocity.x) + class DriverIncomingTrackersBehaviour( private val appContext: AppContextProvider, ) : SolarXRBridgeBehaviour { @@ -162,7 +165,7 @@ class DriverIncomingTrackersBehaviour( lastVelocity?.let { val deltaVelocity = (velocity - it.second) val deltaTime = (now - it.first).inFloatingSeconds - deltaVelocity / deltaTime + remapVelocity(deltaVelocity / deltaTime) } } // Rotation offset done here before rotation gets to the tracker