mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-12-06 00:32:35 -08:00
fix: avoid calculating velocity if accel is available
This commit is contained in:
1 file changed
+2
-4
@@ -191,8 +191,8 @@ class DriverIncomingTrackersBehaviour(
|
||||
val trackerId = event.trackerId.toInt()
|
||||
if (trackerId == 0) return@on
|
||||
|
||||
// Map velocity to accel
|
||||
val velocityAcceleration = event.linearVelocity?.let { velocity ->
|
||||
// use linear acceleration if available, otherwise use calculated acceleration from velocity
|
||||
val acceleration = event.linearAcceleration?.toVector3() ?: event.linearVelocity?.let { velocity ->
|
||||
val now = timeSource.markNow()
|
||||
val velocity = velocity.toVector3()
|
||||
val lastVelocity = lastVelocities[trackerId]
|
||||
@@ -204,8 +204,6 @@ class DriverIncomingTrackersBehaviour(
|
||||
remapVelocity(deltaVelocity / deltaTime)
|
||||
}
|
||||
}
|
||||
// use linear acceleration if available, otherwise use calculated acceleration from velocity
|
||||
val acceleration = event.linearAcceleration?.toVector3() ?: velocityAcceleration
|
||||
// Rotation offset done here before rotation gets to the tracker
|
||||
val rotationOffset = rotationOffsets[trackerId] ?: Quaternion.IDENTITY
|
||||
// Update tracker with new data
|
||||
|
||||
Reference in new issue
Block a user