mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-04-06 02:01:58 +02:00
Restrict mounting reset on server by tracker reset status (#1169)
Co-authored-by: lucas lelievre <loucass003@gmail.com>
This commit is contained in:
@@ -56,6 +56,10 @@ class StatusSystem {
|
||||
it.onStatusRemoved(id)
|
||||
}
|
||||
}
|
||||
|
||||
fun hasStatusType(dataType: Byte): Boolean = statuses.any {
|
||||
it.value.type == dataType
|
||||
}
|
||||
}
|
||||
|
||||
interface StatusListener {
|
||||
|
||||
@@ -26,6 +26,7 @@ import io.github.axisangles.ktmath.Vector3
|
||||
import io.github.axisangles.ktmath.Vector3.Companion.NEG_Y
|
||||
import io.github.axisangles.ktmath.Vector3.Companion.NULL
|
||||
import io.github.axisangles.ktmath.Vector3.Companion.POS_Y
|
||||
import solarxr_protocol.rpc.StatusData
|
||||
import java.lang.IllegalArgumentException
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
@@ -1102,6 +1103,12 @@ class HumanSkeleton(
|
||||
|
||||
@VRServerThread
|
||||
fun resetTrackersMounting(resetSourceName: String?) {
|
||||
val server = humanPoseManager.server
|
||||
if (server != null && server.statusSystem.hasStatusType(StatusData.StatusTrackerReset)) {
|
||||
LogManager.info("[HumanSkeleton] Reset: mounting ($resetSourceName) failed, reset required")
|
||||
return
|
||||
}
|
||||
|
||||
// Resets the mounting orientation of the trackers with the HMD as reference.
|
||||
var referenceRotation = IDENTITY
|
||||
headTracker?.let {
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package dev.slimevr.tracking.processor.skeleton;
|
||||
|
||||
|
||||
import dev.slimevr.VRServer;
|
||||
import dev.slimevr.config.TapDetectionConfig;
|
||||
import dev.slimevr.reset.ResetHandler;
|
||||
import dev.slimevr.setup.TapSetupHandler;
|
||||
import dev.slimevr.tracking.processor.HumanPoseManager;
|
||||
import dev.slimevr.tracking.trackers.Tracker;
|
||||
import solarxr_protocol.rpc.ResetType;
|
||||
import solarxr_protocol.rpc.StatusData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -192,6 +194,13 @@ public class TapDetectionManager {
|
||||
}
|
||||
|
||||
private void checkMountingReset() {
|
||||
// Don't allow mounting if tracker needs reset
|
||||
VRServer server = humanPoseManager.getServer();
|
||||
if (server != null && server.statusSystem.hasStatusType(StatusData.StatusTrackerReset)) {
|
||||
mountingResetDetector.resetDetector();
|
||||
return;
|
||||
}
|
||||
|
||||
boolean tapped = (mountingResetTaps <= mountingResetDetector.getTaps());
|
||||
|
||||
if (tapped && mountingResetAllowPlaySound) {
|
||||
|
||||
Reference in New Issue
Block a user