Use position from SteamVR

This commit is contained in:
Sapphire committed 2026-05-11 14:06:08 -05:00
1 parent 2f6cb0ab0d
commit c71bb3e9c4
2 files changed
+15 -3

No files matched your search

@@ -12,6 +12,7 @@ import dev.slimevr.driver.DriverBridge
import dev.slimevr.driver.DriverBridgeInbound
import dev.slimevr.driver.DriverBridgeOutbound
import io.github.axisangles.ktmath.Quaternion
import io.github.axisangles.ktmath.Vector3
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.Flow
@@ -104,13 +105,22 @@ suspend fun handleDriverConnection(
}
}
msg.tracker_added?.let { ta ->
bridge.inbound.emit(DriverBridgeInbound.TrackerAdded(id = ta.tracker_id, name = ta.tracker_name, manufacturer = ta.manufacturer.ifEmpty { "SlimeVR" }, serial = ta.tracker_serial))
bridge.inbound.emit(DriverBridgeInbound.TrackerAdded(
id = ta.tracker_id,
name = ta.tracker_name,
manufacturer = ta.manufacturer.ifEmpty { "SlimeVR" },
serial = ta.tracker_serial
))
}
msg.battery?.let { bat ->
bridge.inbound.emit(DriverBridgeInbound.TrackerBattery(id = bat.tracker_id, batteryLevel = bat.battery_level, charging = bat.is_charging))
}
msg.position?.let { pos ->
bridge.inbound.emit(DriverBridgeInbound.TrackerPosition(trackerId = pos.tracker_id, rotation = Quaternion(w = pos.qw, x = pos.qx, y = pos.qy, z = pos.qz), position = null))
bridge.inbound.emit(DriverBridgeInbound.TrackerPosition(
trackerId = pos.tracker_id,
rotation = Quaternion(w = pos.qw, x = pos.qx, y = pos.qy, z = pos.qz),
position = if (pos.x != null && pos.y != null && pos.z != null) Vector3(pos.x, pos.y, pos.z) else null,
))
}
}
} finally {