mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-23 10:31:24 -08:00
Compare commits
7
Commits
v0.16.1
...
height-config
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c9cdf71a7 | ||
|
|
069da63d1f | ||
|
|
3fbe58b027 | ||
|
|
aa6b5ab028 | ||
|
|
b2ee4e0b5e | ||
|
|
34ab0c6252 | ||
|
|
a8116a7f35 |
No files matched your search
Generated
+3
-3
@@ -2645,7 +2645,7 @@ version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56"
|
||||
dependencies = [
|
||||
"proc-macro-crate 1.3.1",
|
||||
"proc-macro-crate 2.0.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.87",
|
||||
@@ -4539,9 +4539,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-fs"
|
||||
version = "2.4.0"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c341290d31991dbca38b31d412c73dfbdb070bb11536784f19dd2211d13b778f"
|
||||
checksum = "8c6ef84ee2f2094ce093e55106d90d763ba343fad57566992962e8f76d113f99"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"dunce",
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
"@tanstack/react-query": "^5.48.0",
|
||||
"@tauri-apps/api": "^2.0.2",
|
||||
"@tauri-apps/plugin-dialog": "^2.0.0",
|
||||
"@tauri-apps/plugin-fs": "^2.0.0",
|
||||
"@tauri-apps/plugin-fs": "2.4.1",
|
||||
"@tauri-apps/plugin-http": "^2.5.0",
|
||||
"@tauri-apps/plugin-os": "^2.0.0",
|
||||
"@tauri-apps/plugin-shell": "^2.0.0",
|
||||
|
||||
@@ -276,7 +276,7 @@ widget-overlay-is_mirrored_label = Display Overlay as Mirror
|
||||
widget-drift_compensation-clear = Clear drift compensation
|
||||
|
||||
## Widget: Clear Reset Mounting
|
||||
widget-clear_mounting = Clear reset mounting
|
||||
widget-clear_mounting = Clear Reset Mounting
|
||||
|
||||
## Widget: Developer settings
|
||||
widget-developer_mode = Developer Mode
|
||||
@@ -586,8 +586,8 @@ settings-general-fk_settings-leg_tweak-floor_clip-description = Floor-clip can r
|
||||
settings-general-fk_settings-leg_tweak-toe_snap-description = Toe-snap attempts to guess the rotation of your feet if foot trackers are not in use.
|
||||
settings-general-fk_settings-leg_tweak-foot_plant-description = Foot-plant rotates your feet to be parallel to the ground when in contact.
|
||||
settings-general-fk_settings-leg_fk = Leg tracking
|
||||
settings-general-fk_settings-leg_fk-reset_mounting_feet-description = Enable feet Mounting Reset by tiptoeing.
|
||||
settings-general-fk_settings-leg_fk-reset_mounting_feet = Feet Mounting Reset
|
||||
settings-general-fk_settings-leg_fk-reset_mounting_feet-description-v1 = Force feet mounting reset during general mounting resets.
|
||||
settings-general-fk_settings-leg_fk-reset_mounting_feet-v1 = Force feet mounting reset
|
||||
settings-general-fk_settings-enforce_joint_constraints = Skeletal Limits
|
||||
settings-general-fk_settings-enforce_joint_constraints-enforce_constraints = Enforce constraints
|
||||
settings-general-fk_settings-enforce_joint_constraints-enforce_constraints-description = Prevents joints from rotating past their limit
|
||||
|
||||
@@ -31,7 +31,7 @@ serde = { version = "1", features = ["derive"] }
|
||||
tauri = { version = "2.0", features = ["devtools", "tray-icon", "image-png", "rustls-tls"] }
|
||||
tauri-runtime = "2.0"
|
||||
tauri-plugin-dialog = "2.0"
|
||||
tauri-plugin-fs = "2.0"
|
||||
tauri-plugin-fs = "2.4.1"
|
||||
tauri-plugin-os = "2.0"
|
||||
tauri-plugin-shell = "2.0"
|
||||
tauri-plugin-store = "2.0"
|
||||
|
||||
@@ -55,7 +55,6 @@ export function WidgetsComponent() {
|
||||
<ResetButton type={ResetType.Yaw} size="big"></ResetButton>
|
||||
<ResetButton type={ResetType.Full} size="big"></ResetButton>
|
||||
<ResetButton type={ResetType.Mounting} size="big"></ResetButton>
|
||||
<ClearMountingButton></ClearMountingButton>
|
||||
<ResetButton
|
||||
type={ResetType.Mounting}
|
||||
size="big"
|
||||
@@ -66,6 +65,7 @@ export function WidgetsComponent() {
|
||||
size="big"
|
||||
bodyPartsToReset="fingers"
|
||||
></ResetButton>
|
||||
<ClearMountingButton></ClearMountingButton>
|
||||
{(typeof __ANDROID__ === 'undefined' || !__ANDROID__?.isThere()) && (
|
||||
<BVHButton></BVHButton>
|
||||
)}
|
||||
|
||||
@@ -23,6 +23,8 @@ import {
|
||||
} from '@/components/commons/icon/ResetIcon';
|
||||
import { useStatusContext } from '@/hooks/status-system';
|
||||
import classNames from 'classnames';
|
||||
import { FootIcon } from '@/components/commons/icon/FootIcon';
|
||||
import { FingersIcon } from '@/components/commons/icon/FingersIcon';
|
||||
|
||||
export function ResetButton({
|
||||
type,
|
||||
@@ -90,15 +92,17 @@ export function ResetButton({
|
||||
const reset = () => {
|
||||
const req = new ResetRequestT();
|
||||
req.resetType = type;
|
||||
if (bodyPartsToReset === 'default') {
|
||||
// Default (server handles it)
|
||||
req.bodyParts = [];
|
||||
} else if (bodyPartsToReset === 'feet') {
|
||||
// Feet
|
||||
req.bodyParts = feetBodyParts;
|
||||
} else if (bodyPartsToReset === 'fingers') {
|
||||
// Fingers
|
||||
req.bodyParts = fingerBodyParts;
|
||||
switch (bodyPartsToReset) {
|
||||
case 'default':
|
||||
// Server handles it. Usually all body parts except fingers.
|
||||
req.bodyParts = [];
|
||||
break;
|
||||
case 'feet':
|
||||
req.bodyParts = feetBodyParts;
|
||||
break;
|
||||
case 'fingers':
|
||||
req.bodyParts = fingerBodyParts;
|
||||
break;
|
||||
}
|
||||
sendRPCPacket(RpcMessage.ResetRequest, req);
|
||||
};
|
||||
@@ -144,7 +148,14 @@ export function ResetButton({
|
||||
case ResetType.Yaw:
|
||||
return <YawResetIcon width={20} />;
|
||||
case ResetType.Mounting:
|
||||
return <MountingResetIcon width={20} />;
|
||||
switch (bodyPartsToReset) {
|
||||
case 'default':
|
||||
return <MountingResetIcon width={20} />;
|
||||
case 'feet':
|
||||
return <FootIcon width={30} />;
|
||||
case 'fingers':
|
||||
return <FingersIcon width={20} />;
|
||||
}
|
||||
}
|
||||
return <FullResetIcon width={20} />;
|
||||
};
|
||||
|
||||
@@ -96,6 +96,7 @@ export type SettingsForm = {
|
||||
correctionStrength: number;
|
||||
};
|
||||
resetsSettings: {
|
||||
resetMountingFeet: boolean;
|
||||
armsMountingResetMode: number;
|
||||
yawResetSmoothTime: number;
|
||||
saveMountingReset: boolean;
|
||||
@@ -156,6 +157,7 @@ const defaultValues: SettingsForm = {
|
||||
},
|
||||
legTweaks: { correctionStrength: 0.3 },
|
||||
resetsSettings: {
|
||||
resetMountingFeet: false,
|
||||
armsMountingResetMode: 0,
|
||||
yawResetSmoothTime: 0.0,
|
||||
saveMountingReset: false,
|
||||
@@ -287,6 +289,8 @@ export function GeneralSettings() {
|
||||
|
||||
if (values.resetsSettings) {
|
||||
const resetsSettings = new ResetsSettingsT();
|
||||
resetsSettings.resetMountingFeet =
|
||||
values.resetsSettings.resetMountingFeet;
|
||||
resetsSettings.armsMountingResetMode =
|
||||
values.resetsSettings.armsMountingResetMode;
|
||||
resetsSettings.yawResetSmoothTime =
|
||||
@@ -861,6 +865,24 @@ export function GeneralSettings() {
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-col pt-2 pb-3">
|
||||
<Typography color="secondary">
|
||||
{l10n.getString(
|
||||
'settings-general-fk_settings-leg_fk-reset_mounting_feet-description-v1'
|
||||
)}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="grid sm:grid-cols-1 gap-3 pb-3">
|
||||
<CheckBox
|
||||
variant="toggle"
|
||||
outlined
|
||||
control={control}
|
||||
name="resetsSettings.resetMountingFeet"
|
||||
label={l10n.getString(
|
||||
'settings-general-fk_settings-leg_fk-reset_mounting_feet-v1'
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Typography color="secondary">
|
||||
{l10n.getString(
|
||||
|
||||
Generated
+6
-6
@@ -60,8 +60,8 @@ importers:
|
||||
specifier: ^2.0.0
|
||||
version: 2.0.0
|
||||
'@tauri-apps/plugin-fs':
|
||||
specifier: ^2.0.0
|
||||
version: 2.0.0
|
||||
specifier: 2.4.1
|
||||
version: 2.4.1
|
||||
'@tauri-apps/plugin-http':
|
||||
specifier: ^2.5.0
|
||||
version: 2.5.0
|
||||
@@ -1254,8 +1254,8 @@ packages:
|
||||
'@tauri-apps/[email protected]':
|
||||
resolution: {integrity: sha512-ApNkejXP2jpPBSifznPPcHTXxu9/YaRW+eJ+8+nYwqp0lLUtebFHG4QhxitM43wwReHE81WAV1DQ/b+2VBftOA==}
|
||||
|
||||
'@tauri-apps/plugin-fs@2.0.0':
|
||||
resolution: {integrity: sha512-BNEeQQ5aH8J5SwYuWgRszVyItsmquRuzK2QRkVj8Z0sCsLnSvJFYI3JHRzzr3ltZGq1nMPtblrlZzuKqVzRawA==}
|
||||
'@tauri-apps/plugin-fs@2.4.1':
|
||||
resolution: {integrity: sha512-vJlKZVGF3UAFGoIEVT6Oq5L4HGDCD78WmA4uhzitToqYiBKWAvZR61M6zAyQzHqLs0ADemkE4RSy/5sCmZm6ZQ==}
|
||||
|
||||
'@tauri-apps/[email protected]':
|
||||
resolution: {integrity: sha512-l4M2DUIsOBIMrbj4dJZwrB4mJiB7OA/2Tj3gEbX2fjq5MOpETklJPKfDvzUTDwuq4lIKCKKykz8E8tpOgvi0EQ==}
|
||||
@@ -5464,9 +5464,9 @@ snapshots:
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.0.2
|
||||
|
||||
'@tauri-apps/plugin-fs@2.0.0':
|
||||
'@tauri-apps/plugin-fs@2.4.1':
|
||||
dependencies:
|
||||
'@tauri-apps/api': 2.0.2
|
||||
'@tauri-apps/api': 2.6.0
|
||||
|
||||
'@tauri-apps/[email protected]':
|
||||
dependencies:
|
||||
|
||||
@@ -306,7 +306,7 @@ class VRServer @JvmOverloads constructor(
|
||||
queueTask { humanPoseManager.resetTrackersYaw(resetSourceName, bodyParts) }
|
||||
}
|
||||
|
||||
fun resetTrackersMounting(resetSourceName: String?, bodyParts: List<Int> = TrackerUtils.allBodyPartsButFeetAndFingers) {
|
||||
fun resetTrackersMounting(resetSourceName: String?, bodyParts: List<Int> = TrackerUtils.allBodyPartsButFingers) {
|
||||
queueTask { humanPoseManager.resetTrackersMounting(resetSourceName, bodyParts) }
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ enum class ArmsResetModes(val id: Int) {
|
||||
|
||||
class ResetsConfig {
|
||||
|
||||
// Always reset mounting for feet
|
||||
var resetMountingFeet = false
|
||||
|
||||
// Reset mode used for the arms
|
||||
var mode = ArmsResetModes.BACK
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package dev.slimevr.protocol.rpc.heightconfig
|
||||
|
||||
import dev.slimevr.protocol.GenericConnection
|
||||
import dev.slimevr.protocol.ProtocolAPI
|
||||
import dev.slimevr.protocol.rpc.RPCHandler
|
||||
import solarxr_protocol.rpc.RpcMessageHeader
|
||||
|
||||
class RPCHeightConfig(
|
||||
rpcHandler: RPCHandler,
|
||||
val api: ProtocolAPI,
|
||||
) {
|
||||
init {
|
||||
rpcHandler.registerPacketListener(
|
||||
0,
|
||||
this::onStartHeightConfig,
|
||||
)
|
||||
rpcHandler.registerPacketListener(
|
||||
0,
|
||||
this::onStopHeightConfig,
|
||||
)
|
||||
rpcHandler.registerPacketListener(
|
||||
0,
|
||||
this::onRequestHeightConfigStatus,
|
||||
)
|
||||
}
|
||||
|
||||
private fun onStartHeightConfig(conn: GenericConnection, messageHeader: RpcMessageHeader) {
|
||||
// Start process for both hmd height or floor height, this will run in the
|
||||
// background and report the status
|
||||
}
|
||||
|
||||
private fun onStopHeightConfig(conn: GenericConnection, messageHeader: RpcMessageHeader) {
|
||||
// Stop height config process? May automatically report this, or just have this
|
||||
// to cancel it
|
||||
}
|
||||
|
||||
private fun onRequestHeightConfigStatus(conn: GenericConnection, messageHeader: RpcMessageHeader) {
|
||||
// Return a status packet with info about the current measurements and status,
|
||||
// this will be the same packet that we send during measurement?
|
||||
}
|
||||
}
|
||||
@@ -346,6 +346,7 @@ public class RPCSettingsBuilder {
|
||||
return ResetsSettings
|
||||
.createResetsSettings(
|
||||
fbb,
|
||||
resetsConfig.getResetMountingFeet(),
|
||||
resetsConfig.getMode().getId(),
|
||||
resetsConfig.getYawResetSmoothTime(),
|
||||
resetsConfig.getSaveMountingReset(),
|
||||
|
||||
@@ -342,6 +342,7 @@ class RPCSettingsHandler(var rpcHandler: RPCHandler, var api: ProtocolAPI) {
|
||||
if (mode != null) {
|
||||
resetsConfig.mode = mode
|
||||
}
|
||||
resetsConfig.resetMountingFeet = req.resetsSettings().resetMountingFeet()
|
||||
resetsConfig.saveMountingReset = req.resetsSettings().saveMountingReset()
|
||||
resetsConfig.yawResetSmoothTime = req.resetsSettings().yawResetSmoothTime()
|
||||
resetsConfig.resetHmdPitch = req.resetsSettings().resetHmdPitch()
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package dev.slimevr.setup
|
||||
|
||||
import dev.slimevr.autobone.StatsCalculator
|
||||
import dev.slimevr.tracking.trackers.Tracker
|
||||
|
||||
class HeightConfigHandler(val tracker: Tracker) {
|
||||
val maxDeviation = 0.1f
|
||||
val stableTimeS = 3f
|
||||
|
||||
// TODO: Collect mean, max, and min values, use max/min to enforce max deviation
|
||||
var accumulator = StatsCalculator()
|
||||
var accumulatedTime = 0f
|
||||
|
||||
fun tick() {
|
||||
val trackerHeight = tracker.position.y
|
||||
|
||||
// Accumulate height and track stability
|
||||
accumulator.addValue(trackerHeight)
|
||||
// TODO: Actual tick time
|
||||
accumulatedTime += 0.1f
|
||||
|
||||
// If the height stability
|
||||
if (accumulator.standardDeviation > maxDeviation) {
|
||||
accumulator.reset()
|
||||
accumulator.addValue(trackerHeight)
|
||||
accumulatedTime = 0f
|
||||
} else if (accumulatedTime >= stableTimeS) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -571,7 +571,7 @@ class HumanPoseManager(val server: VRServer?) {
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun resetTrackersMounting(resetSourceName: String?, bodyParts: List<Int> = TrackerUtils.allBodyPartsButFeetAndFingers) {
|
||||
fun resetTrackersMounting(resetSourceName: String?, bodyParts: List<Int> = TrackerUtils.allBodyPartsButFingers) {
|
||||
skeleton.resetTrackersMounting(resetSourceName, bodyParts)
|
||||
}
|
||||
|
||||
|
||||
+18
-11
@@ -1520,12 +1520,12 @@ class HumanSkeleton(
|
||||
@JvmOverloads
|
||||
fun resetTrackersFull(resetSourceName: String?, bodyParts: List<Int> = ArrayList()) {
|
||||
var referenceRotation = IDENTITY
|
||||
if (bodyParts.isEmpty() || bodyParts.contains(BodyPart.HEAD)) {
|
||||
headTracker?.let {
|
||||
headTracker?.let {
|
||||
if (bodyParts.isEmpty() || bodyParts.contains(BodyPart.HEAD)) {
|
||||
// Always reset the head (ifs in resetsHandler)
|
||||
it.resetsHandler.resetFull(referenceRotation)
|
||||
referenceRotation = it.getRotation()
|
||||
}
|
||||
referenceRotation = it.getRotation()
|
||||
}
|
||||
|
||||
// Resets all axes of the trackers with the HMD as reference.
|
||||
@@ -1551,14 +1551,14 @@ class HumanSkeleton(
|
||||
fun resetTrackersYaw(resetSourceName: String?, bodyParts: List<Int> = TrackerUtils.allBodyPartsButFingers) {
|
||||
// Resets the yaw of the trackers with the head as reference.
|
||||
var referenceRotation = IDENTITY
|
||||
if (bodyParts.isEmpty() || bodyParts.contains(BodyPart.HEAD)) {
|
||||
headTracker?.let {
|
||||
headTracker?.let {
|
||||
if (bodyParts.isEmpty() || bodyParts.contains(BodyPart.HEAD)) {
|
||||
// Only reset if head needsReset and isn't computed
|
||||
if (it.needsReset && !it.isComputed) {
|
||||
it.resetsHandler.resetYaw(referenceRotation)
|
||||
}
|
||||
referenceRotation = it.getRotation()
|
||||
}
|
||||
referenceRotation = it.getRotation()
|
||||
}
|
||||
for (tracker in trackersToReset) {
|
||||
// Only reset if tracker needsReset
|
||||
@@ -1570,9 +1570,13 @@ class HumanSkeleton(
|
||||
LogManager.info("[HumanSkeleton] Reset: yaw ($resetSourceName)")
|
||||
}
|
||||
|
||||
/**
|
||||
* if bodyParts is empty, this resets mounting for all trackers.
|
||||
* Keep in mind TrackerResetsHandler.kt has some logic as well for which trackers get reset (feet)
|
||||
*/
|
||||
@VRServerThread
|
||||
@JvmOverloads
|
||||
fun resetTrackersMounting(resetSourceName: String?, bodyParts: List<Int> = ArrayList()) {
|
||||
fun resetTrackersMounting(resetSourceName: String?, bodyParts: List<Int>) {
|
||||
val trackersToReset = trackersToReset
|
||||
|
||||
// TODO: PLEASE rewrite this handling at some point in the future... This is so
|
||||
@@ -1587,19 +1591,22 @@ class HumanSkeleton(
|
||||
|
||||
// Resets the mounting orientation of the trackers with the HMD as reference.
|
||||
var referenceRotation = IDENTITY
|
||||
if (bodyParts.isEmpty() || bodyParts.contains(BodyPart.HEAD)) {
|
||||
headTracker?.let {
|
||||
headTracker?.let {
|
||||
if (bodyParts.isEmpty() || bodyParts.contains(BodyPart.HEAD)) {
|
||||
// Only reset if head needsMounting or is computed but not HMD
|
||||
if (it.needsMounting || (it.isComputed && !it.isHmd)) {
|
||||
it.resetsHandler.resetMounting(referenceRotation)
|
||||
}
|
||||
referenceRotation = it.getRotation()
|
||||
}
|
||||
referenceRotation = it.getRotation()
|
||||
}
|
||||
|
||||
// If onlyFeet is true, feet will be forced to be mounting reset in their reset handlers.
|
||||
val onlyFeet = bodyParts.isNotEmpty() && bodyParts.all { it == BodyPart.LEFT_FOOT || it == BodyPart.RIGHT_FOOT }
|
||||
for (tracker in trackersToReset) {
|
||||
// Only reset if tracker needsMounting
|
||||
if (tracker != null && tracker.needsMounting && (bodyParts.isEmpty() || bodyParts.contains(tracker.trackerPosition?.bodyPart))) {
|
||||
tracker.resetsHandler.resetMounting(referenceRotation)
|
||||
tracker.resetsHandler.resetMounting(referenceRotation, onlyFeet)
|
||||
}
|
||||
}
|
||||
legTweaks.resetBuffer()
|
||||
|
||||
+12
-1
@@ -7,6 +7,7 @@ import dev.slimevr.reset.ResetHandler;
|
||||
import dev.slimevr.setup.TapSetupHandler;
|
||||
import dev.slimevr.tracking.processor.HumanPoseManager;
|
||||
import dev.slimevr.tracking.trackers.Tracker;
|
||||
import dev.slimevr.tracking.trackers.TrackerUtils;
|
||||
import solarxr_protocol.rpc.ResetType;
|
||||
import solarxr_protocol.rpc.StatusData;
|
||||
|
||||
@@ -215,7 +216,17 @@ public class TapDetectionManager {
|
||||
&& System.nanoTime() - mountingResetDetector.getDetectionTime()
|
||||
> mountingResetDelayNs
|
||||
) {
|
||||
skeleton.resetTrackersMounting(resetSourceName);
|
||||
// This will ask the skeleton for a mounting reset on every tracker
|
||||
// except fingers.
|
||||
// However, feet being reset or not will end up being decided on a
|
||||
// per-tracker basis
|
||||
// due to the setting being in ResetsConfig.kt
|
||||
skeleton
|
||||
.resetTrackersMounting(
|
||||
resetSourceName,
|
||||
TrackerUtils.INSTANCE.getAllBodyPartsButFingers()
|
||||
);
|
||||
|
||||
mountingResetDetector.resetDetector();
|
||||
mountingResetAllowPlaySound = true;
|
||||
this.resetHandler.sendFinished(ResetType.Mounting);
|
||||
|
||||
@@ -38,6 +38,7 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
private var compensateDrift = false
|
||||
private var driftPrediction = false
|
||||
private var driftCompensationEnabled = false
|
||||
private var resetMountingFeet = false
|
||||
private var armsResetMode = ArmsResetModes.BACK
|
||||
private var yawResetSmoothTime = 0.0f
|
||||
var saveMountingReset = false
|
||||
@@ -163,6 +164,7 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
* Reads/loads reset settings from the given config
|
||||
*/
|
||||
fun readResetConfig(config: ResetsConfig) {
|
||||
resetMountingFeet = config.resetMountingFeet
|
||||
armsResetMode = config.mode
|
||||
yawResetSmoothTime = config.yawResetSmoothTime
|
||||
saveMountingReset = config.saveMountingReset
|
||||
@@ -391,14 +393,17 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
/**
|
||||
* Perform the math to align the tracker to go forward
|
||||
* and stores it in mountRotFix, and adjusts yawFix
|
||||
* If forceFeet is true, always reset feet regardless of resetMountingFeet's value.
|
||||
*/
|
||||
fun resetMounting(reference: Quaternion) {
|
||||
fun resetMounting(reference: Quaternion, forceFeet: Boolean = false) {
|
||||
if (tracker.trackerDataType == TrackerDataType.FLEX_RESISTANCE) {
|
||||
tracker.trackerFlexHandler.resetMax()
|
||||
tracker.resetFilteringQuats(reference)
|
||||
return
|
||||
} else if (tracker.trackerDataType == TrackerDataType.FLEX_ANGLE) {
|
||||
return
|
||||
} else if (!resetMountingFeet && tracker.trackerPosition.isFoot() && !forceFeet) {
|
||||
return
|
||||
}
|
||||
|
||||
constraintFix = Quaternion.IDENTITY
|
||||
@@ -591,98 +596,4 @@ class TrackerResetsHandler(val tracker: Tracker) {
|
||||
}
|
||||
return totalMatrix.toQuaternion()
|
||||
}
|
||||
|
||||
private fun isThighTracker(): Boolean {
|
||||
tracker.trackerPosition?.let {
|
||||
return it == TrackerPosition.LEFT_UPPER_LEG ||
|
||||
it == TrackerPosition.RIGHT_UPPER_LEG
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun isLeftArmTracker(): Boolean {
|
||||
tracker.trackerPosition?.let {
|
||||
return it == TrackerPosition.LEFT_SHOULDER ||
|
||||
it == TrackerPosition.LEFT_UPPER_ARM ||
|
||||
it == TrackerPosition.LEFT_LOWER_ARM ||
|
||||
it == TrackerPosition.LEFT_HAND
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun isRightArmTracker(): Boolean {
|
||||
tracker.trackerPosition?.let {
|
||||
return it == TrackerPosition.RIGHT_SHOULDER ||
|
||||
it == TrackerPosition.RIGHT_UPPER_ARM ||
|
||||
it == TrackerPosition.RIGHT_LOWER_ARM ||
|
||||
it == TrackerPosition.RIGHT_HAND
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun isLeftLowerArmTracker(): Boolean {
|
||||
tracker.trackerPosition?.let {
|
||||
return it == TrackerPosition.LEFT_LOWER_ARM ||
|
||||
it == TrackerPosition.LEFT_HAND
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun isRightLowerArmTracker(): Boolean {
|
||||
tracker.trackerPosition?.let {
|
||||
return it == TrackerPosition.RIGHT_LOWER_ARM ||
|
||||
it == TrackerPosition.RIGHT_HAND
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun isFootTracker(): Boolean {
|
||||
tracker.trackerPosition?.let {
|
||||
return it == TrackerPosition.LEFT_FOOT ||
|
||||
it == TrackerPosition.RIGHT_FOOT
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun isLeftFingerTracker(): Boolean {
|
||||
tracker.trackerPosition?.let {
|
||||
return it == TrackerPosition.LEFT_THUMB_METACARPAL ||
|
||||
it == TrackerPosition.LEFT_THUMB_PROXIMAL ||
|
||||
it == TrackerPosition.LEFT_THUMB_DISTAL ||
|
||||
it == TrackerPosition.LEFT_INDEX_PROXIMAL ||
|
||||
it == TrackerPosition.LEFT_INDEX_INTERMEDIATE ||
|
||||
it == TrackerPosition.LEFT_INDEX_DISTAL ||
|
||||
it == TrackerPosition.LEFT_MIDDLE_PROXIMAL ||
|
||||
it == TrackerPosition.LEFT_MIDDLE_INTERMEDIATE ||
|
||||
it == TrackerPosition.LEFT_MIDDLE_DISTAL ||
|
||||
it == TrackerPosition.LEFT_RING_PROXIMAL ||
|
||||
it == TrackerPosition.LEFT_RING_INTERMEDIATE ||
|
||||
it == TrackerPosition.LEFT_RING_DISTAL ||
|
||||
it == TrackerPosition.LEFT_LITTLE_PROXIMAL ||
|
||||
it == TrackerPosition.LEFT_LITTLE_INTERMEDIATE ||
|
||||
it == TrackerPosition.LEFT_LITTLE_DISTAL
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun isRightFingerTracker(): Boolean {
|
||||
tracker.trackerPosition?.let {
|
||||
return it == TrackerPosition.RIGHT_THUMB_METACARPAL ||
|
||||
it == TrackerPosition.RIGHT_THUMB_PROXIMAL ||
|
||||
it == TrackerPosition.RIGHT_THUMB_DISTAL ||
|
||||
it == TrackerPosition.RIGHT_INDEX_PROXIMAL ||
|
||||
it == TrackerPosition.RIGHT_INDEX_INTERMEDIATE ||
|
||||
it == TrackerPosition.RIGHT_INDEX_DISTAL ||
|
||||
it == TrackerPosition.RIGHT_MIDDLE_PROXIMAL ||
|
||||
it == TrackerPosition.RIGHT_MIDDLE_INTERMEDIATE ||
|
||||
it == TrackerPosition.RIGHT_MIDDLE_DISTAL ||
|
||||
it == TrackerPosition.RIGHT_RING_PROXIMAL ||
|
||||
it == TrackerPosition.RIGHT_RING_INTERMEDIATE ||
|
||||
it == TrackerPosition.RIGHT_RING_DISTAL ||
|
||||
it == TrackerPosition.RIGHT_LITTLE_PROXIMAL ||
|
||||
it == TrackerPosition.RIGHT_LITTLE_INTERMEDIATE ||
|
||||
it == TrackerPosition.RIGHT_LITTLE_DISTAL
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -102,13 +102,4 @@ object TrackerUtils {
|
||||
BodyPart.RIGHT_HAND, BodyPart.LEFT_SHOULDER, BodyPart.RIGHT_SHOULDER,
|
||||
BodyPart.LEFT_FOOT, BodyPart.RIGHT_FOOT,
|
||||
)
|
||||
|
||||
val allBodyPartsButFeetAndFingers = listOf(
|
||||
BodyPart.HEAD, BodyPart.NECK, BodyPart.UPPER_CHEST,
|
||||
BodyPart.CHEST, BodyPart.WAIST, BodyPart.HIP,
|
||||
BodyPart.LEFT_UPPER_LEG, BodyPart.RIGHT_UPPER_LEG, BodyPart.LEFT_LOWER_LEG,
|
||||
BodyPart.RIGHT_LOWER_LEG, BodyPart.LEFT_LOWER_ARM, BodyPart.RIGHT_LOWER_ARM,
|
||||
BodyPart.LEFT_UPPER_ARM, BodyPart.RIGHT_UPPER_ARM, BodyPart.LEFT_HAND,
|
||||
BodyPart.RIGHT_HAND, BodyPart.LEFT_SHOULDER, BodyPart.RIGHT_SHOULDER,
|
||||
)
|
||||
}
|
||||
+1
-1
Submodule solarxr-protocol updated: f62b57ee9e...df26226d10.
Reference in new issue
Block a user