mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-20 09:01:20 -08:00
Allow selecting which body part to use for tap resets
This commit is contained in:
9 files changed
+235
-25
No files matched your search
@@ -671,7 +671,7 @@ settings-general-fk_settings-self_localization-description = Mocap Mode allows t
|
||||
## Gesture control settings (tracker tapping)
|
||||
settings-general-gesture_control = Gesture control
|
||||
settings-general-gesture_control-subtitle = Tap based resets
|
||||
settings-general-gesture_control-description = Allows for resets to be triggered by tapping a tracker. The tracker highest up on your torso is used for Yaw Reset, the tracker highest up on your left leg is used for Full Reset, and the tracker highest up on your right leg is used for Mounting Calibration. Taps must occur within the time limit of 0.3 seconds times the number of taps to be recognized.
|
||||
settings-general-gesture_control-description = Allows for resets to be triggered by tapping a tracker. If the preferred body part is unset, or the preferred body part is not assigned to a connected tracker, the tracker highest up on your torso is used for Yaw Reset, the tracker highest up on your left leg is used for Full Reset, and the tracker highest up on your right leg is used for Mounting Calibration. Taps must occur within the time limit of 0.3 seconds times the number of taps to be recognized.
|
||||
# This is a unit: 3 taps, 2 taps, 1 tap
|
||||
# $amount (Number) - Amount of taps (touches to the tracker's case)
|
||||
settings-general-gesture_control-taps = { $amount ->
|
||||
@@ -684,13 +684,20 @@ settings-general-gesture_control-trackers = { $amount ->
|
||||
[one] 1 tracker
|
||||
*[other] { $amount } trackers
|
||||
}
|
||||
settings-general-gesture_control-part_select = Which tracker do you want to tap to trigger the reset?
|
||||
settings-general-gesture_control-part_select-edit = Edit
|
||||
settings-general-gesture_control-part_select-reset = Reset preference
|
||||
settings-general-gesture_control-part_select-no_preference = No preference
|
||||
settings-general-gesture_control-yawResetEnabled = Enable tap to yaw reset
|
||||
settings-general-gesture_control-yawResetPart = Preferred tracker for yaw reset taps
|
||||
settings-general-gesture_control-yawResetDelay = Yaw reset delay
|
||||
settings-general-gesture_control-yawResetTaps = Taps for yaw reset
|
||||
settings-general-gesture_control-fullResetEnabled = Enable tap to full reset
|
||||
settings-general-gesture_control-fullResetPart = Preferred tracker for full reset taps
|
||||
settings-general-gesture_control-fullResetDelay = Full reset delay
|
||||
settings-general-gesture_control-fullResetTaps = Taps for full reset
|
||||
settings-general-gesture_control-mountingResetEnabled = Enable tap to perform mounting calibration
|
||||
settings-general-gesture_control-mountingResetPart = Preferred tracker for mounting calibration taps
|
||||
settings-general-gesture_control-mountingResetDelay = Mounting calibration delay
|
||||
settings-general-gesture_control-mountingResetTaps = Taps for mounting calibration
|
||||
# The number of trackers that can have higher acceleration before a tap is rejected
|
||||
|
||||
@@ -103,11 +103,13 @@ export function BodyAssignment({
|
||||
rolesWithErrors = {},
|
||||
highlightedRoles = [],
|
||||
onlyAssigned = false,
|
||||
showAssignedTracker = true,
|
||||
dotSize,
|
||||
}: {
|
||||
assignMode: AssignMode | null;
|
||||
mirror: boolean;
|
||||
onlyAssigned?: boolean;
|
||||
showAssignedTracker?: boolean;
|
||||
rolesWithErrors?: Partial<Record<BodyPart, BodyPartError>>;
|
||||
highlightedRoles?: BodyPart[];
|
||||
onRoleSelected: (role: BodyPart) => void;
|
||||
@@ -165,6 +167,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(BodyPart.HEAD) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[BodyPart.HEAD]?.label}
|
||||
td={trackerPartGrouped[BodyPart.HEAD]}
|
||||
role={BodyPart.HEAD}
|
||||
@@ -176,6 +179,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(BodyPart.NECK) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[BodyPart.NECK]?.label}
|
||||
td={trackerPartGrouped[BodyPart.NECK]}
|
||||
role={BodyPart.NECK}
|
||||
@@ -188,6 +192,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(SIDES[left].shoulder) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[SIDES[left].shoulder]?.label}
|
||||
td={trackerPartGrouped[SIDES[left].shoulder]}
|
||||
role={SIDES[left].shoulder}
|
||||
@@ -199,6 +204,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(SIDES[left].upperArm) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[SIDES[left].upperArm]?.label}
|
||||
td={trackerPartGrouped[SIDES[left].upperArm]}
|
||||
role={SIDES[left].upperArm}
|
||||
@@ -211,6 +217,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(SIDES[left].lowerArm) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[SIDES[left].lowerArm]?.label}
|
||||
td={trackerPartGrouped[SIDES[left].lowerArm]}
|
||||
role={SIDES[left].lowerArm}
|
||||
@@ -222,6 +229,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(SIDES[left].hand) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[SIDES[left].hand]?.label}
|
||||
td={trackerPartGrouped[SIDES[left].hand]}
|
||||
role={SIDES[left].hand}
|
||||
@@ -234,6 +242,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(BodyPart.HIP) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[BodyPart.HIP]?.label}
|
||||
td={trackerPartGrouped[BodyPart.HIP]}
|
||||
onClick={() => onRoleSelected(BodyPart.HIP)}
|
||||
@@ -246,6 +255,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(SIDES[left].upperLeg) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[SIDES[left].upperLeg]?.label}
|
||||
td={trackerPartGrouped[SIDES[left].upperLeg]}
|
||||
role={SIDES[left].upperLeg}
|
||||
@@ -257,6 +267,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(SIDES[left].lowerLeg) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[SIDES[left].lowerLeg]?.label}
|
||||
td={trackerPartGrouped[SIDES[left].lowerLeg]}
|
||||
role={SIDES[left].lowerLeg}
|
||||
@@ -268,6 +279,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(SIDES[left].foot) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[SIDES[left].foot]?.label}
|
||||
td={trackerPartGrouped[SIDES[left].foot]}
|
||||
role={SIDES[left].foot}
|
||||
@@ -284,6 +296,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(BodyPart.UPPER_CHEST) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[BodyPart.UPPER_CHEST]?.label}
|
||||
td={trackerPartGrouped[BodyPart.UPPER_CHEST]}
|
||||
role={BodyPart.UPPER_CHEST}
|
||||
@@ -295,6 +308,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(BodyPart.CHEST) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[BodyPart.CHEST]?.label}
|
||||
td={trackerPartGrouped[BodyPart.CHEST]}
|
||||
role={BodyPart.CHEST}
|
||||
@@ -308,6 +322,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(SIDES[right].shoulder) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[SIDES[right].shoulder]?.label}
|
||||
td={trackerPartGrouped[SIDES[right].shoulder]}
|
||||
role={SIDES[right].shoulder}
|
||||
@@ -319,6 +334,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(SIDES[right].upperArm) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[SIDES[right].upperArm]?.label}
|
||||
td={trackerPartGrouped[SIDES[right].upperArm]}
|
||||
role={SIDES[right].upperArm}
|
||||
@@ -332,6 +348,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(SIDES[right].lowerArm) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[SIDES[right].lowerArm]?.label}
|
||||
td={trackerPartGrouped[SIDES[right].lowerArm]}
|
||||
role={SIDES[right].lowerArm}
|
||||
@@ -343,6 +360,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(SIDES[right].hand) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[SIDES[right].hand]?.label}
|
||||
td={trackerPartGrouped[SIDES[right].hand]}
|
||||
onClick={() => onRoleSelected(SIDES[right].hand)}
|
||||
@@ -355,6 +373,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(BodyPart.WAIST) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[BodyPart.WAIST]?.label}
|
||||
td={trackerPartGrouped[BodyPart.WAIST]}
|
||||
onClick={() => onRoleSelected(BodyPart.WAIST)}
|
||||
@@ -367,6 +386,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(SIDES[right].upperLeg) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[SIDES[right].upperLeg]?.label}
|
||||
td={trackerPartGrouped[SIDES[right].upperLeg]}
|
||||
role={SIDES[right].upperLeg}
|
||||
@@ -378,6 +398,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(SIDES[right].lowerLeg) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[SIDES[right].lowerLeg]?.label}
|
||||
td={trackerPartGrouped[SIDES[right].lowerLeg]}
|
||||
role={SIDES[right].lowerLeg}
|
||||
@@ -389,6 +410,7 @@ export function BodyAssignment({
|
||||
{hasBodyPart(SIDES[right].foot) && (
|
||||
<TrackerPartCard
|
||||
onlyAssigned={onlyAssigned}
|
||||
showAssignedTracker={showAssignedTracker}
|
||||
roleError={rolesWithErrors[SIDES[right].foot]?.label}
|
||||
td={trackerPartGrouped[SIDES[right].foot]}
|
||||
role={SIDES[right].foot}
|
||||
|
||||
@@ -100,7 +100,11 @@ export function TrackersAssignPage() {
|
||||
tapDetectionSettings.mountingResetDelay,
|
||||
tapDetectionSettings.mountingResetEnabled,
|
||||
tapDetectionSettings.mountingResetTaps,
|
||||
true
|
||||
true,
|
||||
null,
|
||||
tapDetectionSettings.yawResetTracker,
|
||||
tapDetectionSettings.fullResetTracker,
|
||||
tapDetectionSettings.mountingResetTracker
|
||||
);
|
||||
|
||||
sendRPCPacket(
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
import { Localized, useLocalization } from '@fluent/react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { DefaultValues, useForm } from 'react-hook-form';
|
||||
import {
|
||||
Control,
|
||||
Controller,
|
||||
DefaultValues,
|
||||
FieldPath,
|
||||
FieldValues,
|
||||
useForm,
|
||||
} from 'react-hook-form';
|
||||
import {
|
||||
ChangeSettingsRequestT,
|
||||
FilteringSettingsT,
|
||||
@@ -15,8 +22,9 @@ import {
|
||||
SteamVRTrackersSettingT,
|
||||
TapDetectionSettingsT,
|
||||
HIDSettingsT,
|
||||
BodyPart,
|
||||
} from 'solarxr-protocol';
|
||||
import { useConfig } from '@/hooks/config';
|
||||
import { AssignMode, defaultConfig, useConfig } from '@/hooks/config';
|
||||
import { useWebsocketAPI } from '@/hooks/websocket-api';
|
||||
import { useLocaleConfig } from '@/i18n/config';
|
||||
import { CheckBox } from '@/components/commons/Checkbox';
|
||||
@@ -46,6 +54,100 @@ import {
|
||||
import { atom, useAtomValue, useSetAtom } from 'jotai';
|
||||
import { isEqual } from '@react-hookz/deep-equal';
|
||||
import { selectAtom } from 'jotai/utils';
|
||||
import { BodyPartIcon } from '@/components/commons/BodyPartIcon';
|
||||
import { Button } from '@/components/commons/Button';
|
||||
import { BodyAssignment } from '@/components/onboarding/BodyAssignment';
|
||||
import { useBreakpoint } from '@/hooks/breakpoint';
|
||||
import ReactModal from 'react-modal';
|
||||
|
||||
function TapResetPartSelector<T extends FieldValues = FieldValues>({
|
||||
id,
|
||||
control,
|
||||
name,
|
||||
}: {
|
||||
id: string;
|
||||
control: Control<T>;
|
||||
name: FieldPath<T>;
|
||||
}) {
|
||||
const { isMobile } = useBreakpoint('mobile');
|
||||
const { config } = useConfig();
|
||||
const [bodyPartSelectorOpen, setBodyPartSelectorOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<Controller
|
||||
control={control}
|
||||
name={name}
|
||||
render={({ field: { onChange, value } }) => (
|
||||
<>
|
||||
<div className="flex flex-col gap-1 w-full">
|
||||
<Typography bold id={id} />
|
||||
<div className="flex justify-between bg-background-80 w-full p-3 rounded-lg">
|
||||
<div className="flex gap-3 items-center fill-background-10">
|
||||
<BodyPartIcon bodyPart={value} />
|
||||
<Typography
|
||||
id={
|
||||
value === BodyPart.NONE
|
||||
? 'settings-general-gesture_control-part_select-no_preference'
|
||||
: 'body_part-' + BodyPart[value]
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex">
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() => setBodyPartSelectorOpen(true)}
|
||||
id="settings-general-gesture_control-part_select-edit"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ReactModal
|
||||
isOpen={bodyPartSelectorOpen}
|
||||
shouldCloseOnOverlayClick
|
||||
shouldCloseOnEsc
|
||||
onRequestClose={() => setBodyPartSelectorOpen(false)}
|
||||
overlayClassName="fixed top-0 right-0 left-0 bottom-0 flex flex-col items-center w-full h-full justify-center bg-background-90 bg-opacity-90 z-20"
|
||||
className="focus:ring-transparent focus:ring-offset-transparent focus:outline-transparent outline-none mt-12 z-10 overflow-y-auto"
|
||||
>
|
||||
<div className="flex w-full h-full flex-col gap-10 px-3">
|
||||
<div className="flex xs:flex-row h-full xs:gap-8 mobile:flex-col xs:justify-center items-center">
|
||||
<div className="flex flex-col xs:flex-grow gap-3 rounded-xl fill-background-50 py-2">
|
||||
<div className="flex flex-col xs:max-w-sm gap-3">
|
||||
<Typography
|
||||
variant="mobile-title"
|
||||
bold
|
||||
id="settings-general-gesture_control-part_select"
|
||||
/>
|
||||
</div>
|
||||
<BodyAssignment
|
||||
mirror={config?.mirrorView ?? defaultConfig.mirrorView}
|
||||
width={isMobile ? 160 : undefined}
|
||||
assignMode={AssignMode.All}
|
||||
showAssignedTracker={false}
|
||||
onRoleSelected={(part) => {
|
||||
onChange(part);
|
||||
setBodyPartSelectorOpen(false);
|
||||
}}
|
||||
/>
|
||||
<div className="flex justify-center">
|
||||
<Button
|
||||
variant="secondary"
|
||||
id="settings-general-gesture_control-part_select-reset"
|
||||
onClick={() => {
|
||||
onChange(BodyPart.NONE);
|
||||
setBodyPartSelectorOpen(false);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ReactModal>
|
||||
</>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export type SettingsForm = {
|
||||
trackers: {
|
||||
@@ -89,15 +191,18 @@ export type SettingsForm = {
|
||||
interpKneeAnkle: number;
|
||||
};
|
||||
tapDetection: {
|
||||
mountingResetEnabled: boolean;
|
||||
yawResetEnabled: boolean;
|
||||
fullResetEnabled: boolean;
|
||||
mountingResetEnabled: boolean;
|
||||
yawResetDelay: number;
|
||||
fullResetDelay: number;
|
||||
mountingResetDelay: number;
|
||||
yawResetTaps: number;
|
||||
fullResetTaps: number;
|
||||
mountingResetTaps: number;
|
||||
yawResetTracker: BodyPart;
|
||||
fullResetTracker: BodyPart;
|
||||
mountingResetTracker: BodyPart;
|
||||
numberTrackersOverThreshold: number;
|
||||
};
|
||||
legTweaks: {
|
||||
@@ -149,15 +254,18 @@ const defaultValues: SettingsForm = {
|
||||
},
|
||||
filtering: { amount: 0.1, type: FilteringType.NONE },
|
||||
tapDetection: {
|
||||
mountingResetEnabled: false,
|
||||
yawResetEnabled: false,
|
||||
fullResetEnabled: false,
|
||||
mountingResetEnabled: false,
|
||||
yawResetDelay: 0.2,
|
||||
fullResetDelay: 1.0,
|
||||
mountingResetDelay: 1.0,
|
||||
yawResetTaps: 2,
|
||||
fullResetTaps: 3,
|
||||
mountingResetTaps: 3,
|
||||
yawResetTracker: BodyPart.NONE,
|
||||
fullResetTracker: BodyPart.NONE,
|
||||
mountingResetTracker: BodyPart.NONE,
|
||||
numberTrackersOverThreshold: 1,
|
||||
},
|
||||
legTweaks: { correctionStrength: 0.3 },
|
||||
@@ -302,13 +410,17 @@ export function GeneralSettings() {
|
||||
tapDetection.fullResetDelay = values.tapDetection.fullResetDelay;
|
||||
tapDetection.fullResetEnabled = values.tapDetection.fullResetEnabled;
|
||||
tapDetection.fullResetTaps = values.tapDetection.fullResetTaps;
|
||||
tapDetection.fullResetTracker = values.tapDetection.fullResetTracker;
|
||||
tapDetection.yawResetDelay = values.tapDetection.yawResetDelay;
|
||||
tapDetection.yawResetEnabled = values.tapDetection.yawResetEnabled;
|
||||
tapDetection.yawResetTaps = values.tapDetection.yawResetTaps;
|
||||
tapDetection.yawResetTracker = values.tapDetection.yawResetTracker;
|
||||
tapDetection.mountingResetEnabled =
|
||||
values.tapDetection.mountingResetEnabled;
|
||||
tapDetection.mountingResetDelay = values.tapDetection.mountingResetDelay;
|
||||
tapDetection.mountingResetTaps = values.tapDetection.mountingResetTaps;
|
||||
tapDetection.mountingResetTracker =
|
||||
values.tapDetection.mountingResetTracker;
|
||||
tapDetection.numberTrackersOverThreshold =
|
||||
values.tapDetection.numberTrackersOverThreshold;
|
||||
tapDetection.setupMode = false;
|
||||
@@ -416,6 +528,15 @@ export function GeneralSettings() {
|
||||
mountingResetTaps:
|
||||
settings.tapDetectionSettings.mountingResetTaps ||
|
||||
defaultValues.tapDetection.mountingResetTaps,
|
||||
yawResetTracker:
|
||||
settings.tapDetectionSettings.yawResetTracker ||
|
||||
defaultValues.tapDetection.yawResetTracker,
|
||||
fullResetTracker:
|
||||
settings.tapDetectionSettings.fullResetTracker ||
|
||||
defaultValues.tapDetection.fullResetTracker,
|
||||
mountingResetTracker:
|
||||
settings.tapDetectionSettings.mountingResetTracker ||
|
||||
defaultValues.tapDetection.mountingResetTracker,
|
||||
numberTrackersOverThreshold:
|
||||
settings.tapDetectionSettings.numberTrackersOverThreshold ||
|
||||
defaultValues.tapDetection.numberTrackersOverThreshold,
|
||||
@@ -1237,6 +1358,23 @@ export function GeneralSettings() {
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="grid sm:grid-cols-3 gap-5 pb-2">
|
||||
<TapResetPartSelector
|
||||
control={control}
|
||||
name="tapDetection.yawResetTracker"
|
||||
id="settings-general-gesture_control-yawResetPart"
|
||||
/>
|
||||
<TapResetPartSelector
|
||||
control={control}
|
||||
name="tapDetection.fullResetTracker"
|
||||
id="settings-general-gesture_control-fullResetPart"
|
||||
/>
|
||||
<TapResetPartSelector
|
||||
control={control}
|
||||
name="tapDetection.mountingResetTracker"
|
||||
id="settings-general-gesture_control-mountingResetPart"
|
||||
/>
|
||||
</div>
|
||||
<div className="grid sm:grid-cols-3 gap-5 pb-2">
|
||||
<NumberSelector
|
||||
control={control}
|
||||
|
||||
@@ -38,12 +38,14 @@ export function TrackerPartCard({
|
||||
direction,
|
||||
roleError,
|
||||
onlyAssigned,
|
||||
showAssignedTracker,
|
||||
onClick,
|
||||
}: {
|
||||
td: FlatDeviceTracker[];
|
||||
role: BodyPart;
|
||||
roleError: string | undefined;
|
||||
onlyAssigned: boolean;
|
||||
showAssignedTracker: boolean;
|
||||
direction: 'left' | 'right';
|
||||
onClick?: MouseEventHandler<HTMLDivElement>;
|
||||
}) {
|
||||
@@ -107,17 +109,21 @@ export function TrackerPartCard({
|
||||
>
|
||||
{l10n.getString('body_part-' + BodyPart[role])}
|
||||
</Typography>
|
||||
{td?.map(({ tracker }, index) => (
|
||||
<Tracker
|
||||
tracker={tracker}
|
||||
key={index}
|
||||
updateVelocity={(vel) => updateVelocity(vel)}
|
||||
/>
|
||||
))}
|
||||
{!td && (
|
||||
<Typography color="text-background-30">
|
||||
{l10n.getString('tracker-part_card-unassigned')}
|
||||
</Typography>
|
||||
{showAssignedTracker && (
|
||||
<>
|
||||
{td?.map(({ tracker }, index) => (
|
||||
<Tracker
|
||||
tracker={tracker}
|
||||
key={index}
|
||||
updateVelocity={(vel) => updateVelocity(vel)}
|
||||
/>
|
||||
))}
|
||||
{!td && (
|
||||
<Typography color="text-background-30">
|
||||
{l10n.getString('tracker-part_card-unassigned')}
|
||||
</Typography>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)) || <></>
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
package dev.slimevr.config
|
||||
|
||||
import com.jme3.math.FastMath
|
||||
|
||||
// handles the tap detection config
|
||||
// this involves the number of taps, the delay, and whether or not the feature is enabled
|
||||
// for each reset type
|
||||
class TapDetectionConfig {
|
||||
var yawResetDelay = 0.2f
|
||||
var fullResetDelay = 1.0f
|
||||
var mountingResetDelay = 1.0f
|
||||
var yawResetEnabled = true
|
||||
var yawResetDesignation: String? = null
|
||||
var fullResetEnabled = true
|
||||
var fullResetDesignation: String? = null
|
||||
var mountingResetEnabled = true
|
||||
var mountingResetDesignation: String? = null
|
||||
var setupMode = false
|
||||
var yawResetTaps = 2
|
||||
set(yawResetTaps) {
|
||||
|
||||
@@ -19,6 +19,7 @@ import dev.slimevr.filtering.TrackerFilters.Companion.getByConfigkey
|
||||
import dev.slimevr.tracking.processor.HumanPoseManager
|
||||
import dev.slimevr.tracking.processor.config.SkeletonConfigToggles
|
||||
import dev.slimevr.tracking.processor.config.SkeletonConfigValues
|
||||
import dev.slimevr.tracking.trackers.TrackerPosition
|
||||
import dev.slimevr.tracking.trackers.TrackerRole
|
||||
import solarxr_protocol.rpc.AutoBoneSettings
|
||||
import solarxr_protocol.rpc.DriftCompensationSettings
|
||||
@@ -163,9 +164,15 @@ fun createTapDetectionSettings(
|
||||
tapDetectionConfig.mountingResetTaps,
|
||||
tapDetectionConfig.setupMode,
|
||||
tapDetectionConfig.numberTrackersOverThreshold,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
tapDetectionConfig.yawResetDesignation?.let {
|
||||
TrackerPosition.getByDesignation(it)
|
||||
}?.bodyPart ?: 0,
|
||||
tapDetectionConfig.fullResetDesignation?.let {
|
||||
TrackerPosition.getByDesignation(it)
|
||||
}?.bodyPart ?: 0,
|
||||
tapDetectionConfig.mountingResetDesignation?.let {
|
||||
TrackerPosition.getByDesignation(it)
|
||||
}?.bodyPart ?: 0
|
||||
)
|
||||
|
||||
fun createSteamVRSettings(fbb: FlatBufferBuilder, bridge: ISteamVRBridge?): Int {
|
||||
|
||||
@@ -9,6 +9,7 @@ import dev.slimevr.protocol.ProtocolAPI
|
||||
import dev.slimevr.protocol.rpc.RPCHandler
|
||||
import dev.slimevr.tracking.processor.config.SkeletonConfigToggles
|
||||
import dev.slimevr.tracking.processor.config.SkeletonConfigValues
|
||||
import dev.slimevr.tracking.trackers.TrackerPosition
|
||||
import dev.slimevr.tracking.trackers.TrackerRole
|
||||
import solarxr_protocol.rpc.ChangeSettingsRequest
|
||||
import solarxr_protocol.rpc.RpcMessage
|
||||
@@ -192,6 +193,10 @@ class RPCSettingsHandler(var rpcHandler: RPCHandler, var api: ProtocolAPI) {
|
||||
.mountingResetTaps = tapDetectionSettings.mountingResetTaps()
|
||||
}
|
||||
|
||||
tapDetectionConfig.yawResetDesignation = TrackerPosition.getByBodyPart(tapDetectionSettings.yawResetTracker())?.designation
|
||||
tapDetectionConfig.fullResetDesignation = TrackerPosition.getByBodyPart(tapDetectionSettings.fullResetTracker())?.designation
|
||||
tapDetectionConfig.mountingResetDesignation = TrackerPosition.getByBodyPart(tapDetectionSettings.mountingResetTracker())?.designation
|
||||
|
||||
api.server.humanPoseManager.updateTapDetectionConfig()
|
||||
}
|
||||
}
|
||||
|
||||
+23
@@ -3,6 +3,8 @@ package dev.slimevr.tracking.processor.skeleton
|
||||
import dev.slimevr.VRServer
|
||||
import dev.slimevr.tracking.processor.HumanPoseManager
|
||||
import dev.slimevr.tracking.trackers.Tracker
|
||||
import dev.slimevr.tracking.trackers.TrackerPosition
|
||||
import dev.slimevr.tracking.trackers.TrackerUtils
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
|
||||
class TapDetectionManager(
|
||||
@@ -87,7 +89,14 @@ class TapDetectionManager(
|
||||
|
||||
private val mountingResetTracker: Tracker?
|
||||
get() {
|
||||
val selectedTracker = config.mountingResetDesignation?.let {
|
||||
TrackerUtils.getTrackerForSkeleton(server.allTrackers,
|
||||
TrackerPosition.getByDesignation(it)
|
||||
?: error("unknown designation '$it'")
|
||||
)
|
||||
}
|
||||
return arrayOf(
|
||||
selectedTracker,
|
||||
skeleton.rightUpperLegTracker,
|
||||
skeleton.rightLowerLegTracker,
|
||||
).firstNotNullOfOrNull { it }
|
||||
@@ -95,7 +104,14 @@ class TapDetectionManager(
|
||||
|
||||
private val fullResetTracker: Tracker?
|
||||
get() {
|
||||
val selectedTracker = config.fullResetDesignation?.let {
|
||||
TrackerUtils.getTrackerForSkeleton(server.allTrackers,
|
||||
TrackerPosition.getByDesignation(it)
|
||||
?: error("unknown designation '$it'")
|
||||
)
|
||||
}
|
||||
return arrayOf(
|
||||
selectedTracker,
|
||||
skeleton.leftUpperLegTracker,
|
||||
skeleton.leftLowerLegTracker,
|
||||
).firstNotNullOfOrNull { it }
|
||||
@@ -103,7 +119,14 @@ class TapDetectionManager(
|
||||
|
||||
private val yawResetTracker: Tracker?
|
||||
get() {
|
||||
val selectedTracker = config.yawResetDesignation?.let {
|
||||
TrackerUtils.getTrackerForSkeleton(server.allTrackers,
|
||||
TrackerPosition.getByDesignation(it)
|
||||
?: error("unknown designation '$it'")
|
||||
)
|
||||
}
|
||||
return arrayOf(
|
||||
selectedTracker,
|
||||
skeleton.upperChestTracker,
|
||||
skeleton.chestTracker,
|
||||
skeleton.hipTracker,
|
||||
|
||||
Reference in new issue
Block a user