mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-26 11:56:27 -08:00
Use position from SteamVR
This commit is contained in:
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 {
|
||||
|
||||
Reference in new issue
Block a user