mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-26 11:56:27 -08:00
Toe tracking server rewrite (#1897)
Co-authored-by: Erimel <[email protected]> Co-authored-by: Erimel <[email protected]> Co-authored-by: loucass003 <[email protected]>
This commit is contained in:
23 files changed
+923
-73
No files matched your search
@@ -23,6 +23,8 @@ version_update-close = Close
|
||||
tips-find_tracker = Not sure which tracker is which? Shake a tracker and it will highlight the corresponding item.
|
||||
tips-do_not_move_heels = Ensure your heels do not move during recording!
|
||||
tips-file_select = Drag & drop files to use, or <u>browse</u>.
|
||||
tips-tap_setup = You can slowly tap your tracker 2 times to choose it instead of selecting it from the menu.
|
||||
tips-turn_on_tracker = Using official SlimeVR trackers? Don't forget to <b><em>turn on your tracker</em></b> after connecting it to the PC!
|
||||
tips-failed_webgl = Failed to initialize WebGL.
|
||||
|
||||
## Units
|
||||
@@ -226,14 +228,22 @@ skeleton_bone-HAND_Z-desc =
|
||||
|
||||
## Tracker reset buttons
|
||||
reset-reset_all = Reset all proportions
|
||||
reset-reset_all_warning-v2 =
|
||||
<b>Warning:</b> Your proportions will be reset to defaults scaled to your configured height.
|
||||
Are you sure you want to do this?
|
||||
reset-reset_all_warning-reset = Reset proportions
|
||||
reset-reset_all_warning-cancel = Cancel
|
||||
reset-reset_all_warning_default-v2 =
|
||||
<b>Warning:</b> Your height has not been configured, your proportions will be reset to defaults with the default height.
|
||||
Are you sure you want to do this?
|
||||
|
||||
reset-full = Full Reset
|
||||
reset-mounting = Mounting Calibration
|
||||
reset-mounting-feet = Feet Calibration
|
||||
reset-mounting-fingers = Fingers Calibration
|
||||
reset-yaw = Yaw Reset
|
||||
reset-error-no_feet_tracker = No feet tracker assigned
|
||||
reset-error-no_fingers_tracker = No finger tracker assigned
|
||||
reset-error-mounting-need_full_reset = Need a full reset before mounting
|
||||
reset-error-yaw-need_full_reset = Need a full reset before yaw reset
|
||||
|
||||
@@ -265,6 +275,14 @@ bvh-save_title = Save BVH recording
|
||||
tracking-unpaused = Pause tracking
|
||||
tracking-paused = Unpause tracking
|
||||
|
||||
## Widget: Overlay settings
|
||||
widget-overlay = Overlay
|
||||
widget-overlay-is_visible_label = Show Overlay in SteamVR
|
||||
widget-overlay-is_mirrored_label = Display Overlay as Mirror
|
||||
|
||||
## Widget: Clear Mounting calibration
|
||||
widget-clear_mounting = Clear mounting calibration
|
||||
|
||||
## Widget: Developer settings
|
||||
widget-developer_mode = Developer Mode
|
||||
widget-developer_mode-high_contrast = High contrast
|
||||
@@ -284,6 +302,10 @@ widget-imu_visualizer-acceleration = Acceleration
|
||||
widget-imu_visualizer-position = Position
|
||||
widget-imu_visualizer-stay_aligned = Stay Aligned
|
||||
|
||||
## Widget: Skeleton Visualizer
|
||||
widget-skeleton_visualizer-preview = Skeleton preview
|
||||
widget-skeleton_visualizer-hide = Hide
|
||||
|
||||
## Tracker status
|
||||
tracker-status-none = No Status
|
||||
tracker-status-busy = Busy
|
||||
@@ -324,6 +346,8 @@ tracker-infos-manufacturer = Manufacturer
|
||||
tracker-infos-display_name = Display Name
|
||||
tracker-infos-custom_name = Custom Name
|
||||
tracker-infos-url = Tracker URL
|
||||
tracker-infos-version = Firmware Version
|
||||
tracker-infos-hardware_rev = Hardware Revision
|
||||
tracker-infos-hardware_identifier = Hardware ID
|
||||
tracker-infos-data_type = Data type
|
||||
tracker-infos-imu = IMU Sensor
|
||||
@@ -386,6 +410,7 @@ dongle-settings-title = Dongle settings
|
||||
dongle-settings-name_section = Dongle name
|
||||
dongle-settings-name_section-description = Give it a cute nickname :3
|
||||
dongle-settings-name_section-placeholder = Futura's usb thingie
|
||||
dongle-settings-name_section-label = Dongle name
|
||||
dongle-settings-update = Update now
|
||||
dongle-settings-update-title = Firmware version
|
||||
dongle-settings-paired_trackers = Paired Trackers
|
||||
@@ -403,11 +428,13 @@ dongle-settings-telemetry-footnote = Loss gap events mark regions where packet u
|
||||
|
||||
|
||||
## Tracker part card info
|
||||
tracker-part_card-no_name = No name
|
||||
tracker-part_card-unassigned = Unassigned
|
||||
|
||||
## Body assignment menu
|
||||
body_assignment_menu = Where do you want this tracker to be?
|
||||
body_assignment_menu-description = Choose a location where you want this tracker to be assigned. Alternatively, you can choose to manage all trackers at once instead of one by one.
|
||||
body_assignment_menu-show_advanced_locations = Show advanced assign locations
|
||||
body_assignment_menu-manage_trackers = Manage all trackers
|
||||
body_assignment_menu-unassign_tracker = Unassign tracker
|
||||
|
||||
@@ -417,6 +444,69 @@ body_assignment_menu-unassign_tracker = Unassign tracker
|
||||
#
|
||||
# We are using it here because english doesn't require changing the text in each case but
|
||||
# maybe your language does.
|
||||
-tracker_selection-part = Which tracker to assign to your
|
||||
tracker_selection_menu-NONE = Which tracker do you want to be unassigned?
|
||||
tracker_selection_menu-HEAD = { -tracker_selection-part } head?
|
||||
tracker_selection_menu-NECK = { -tracker_selection-part } neck?
|
||||
tracker_selection_menu-RIGHT_SHOULDER = { -tracker_selection-part } right shoulder?
|
||||
tracker_selection_menu-RIGHT_UPPER_ARM = { -tracker_selection-part } right upper arm?
|
||||
tracker_selection_menu-RIGHT_LOWER_ARM = { -tracker_selection-part } right lower arm?
|
||||
tracker_selection_menu-RIGHT_HAND = { -tracker_selection-part } right hand?
|
||||
tracker_selection_menu-RIGHT_UPPER_LEG = { -tracker_selection-part } right thigh?
|
||||
tracker_selection_menu-RIGHT_LOWER_LEG = { -tracker_selection-part } right ankle?
|
||||
tracker_selection_menu-RIGHT_FOOT = { -tracker_selection-part } right foot?
|
||||
tracker_selection_menu-UPPER_CHEST = { -tracker_selection-part } upper chest?
|
||||
tracker_selection_menu-CHEST = { -tracker_selection-part } chest?
|
||||
tracker_selection_menu-WAIST = { -tracker_selection-part } waist?
|
||||
tracker_selection_menu-HIP = { -tracker_selection-part } hip?
|
||||
tracker_selection_menu-LEFT_SHOULDER = { -tracker_selection-part } left shoulder?
|
||||
tracker_selection_menu-LEFT_UPPER_ARM = { -tracker_selection-part } left upper arm?
|
||||
tracker_selection_menu-LEFT_LOWER_ARM = { -tracker_selection-part } left lower arm?
|
||||
tracker_selection_menu-LEFT_HAND = { -tracker_selection-part } left hand?
|
||||
tracker_selection_menu-LEFT_UPPER_LEG = { -tracker_selection-part } left thigh?
|
||||
tracker_selection_menu-LEFT_LOWER_LEG = { -tracker_selection-part } left ankle?
|
||||
tracker_selection_menu-LEFT_FOOT = { -tracker_selection-part } left foot?
|
||||
|
||||
tracker_selection_menu-unassigned = Unassigned Trackers
|
||||
tracker_selection_menu-assigned = Assigned Trackers
|
||||
tracker_selection_menu-dont_assign = Unassign
|
||||
|
||||
-tracker_selection-part = Which tracker to assign to your
|
||||
tracker_selection_menu-NONE = Which tracker do you want to be unassigned?
|
||||
tracker_selection_menu-HEAD = { -tracker_selection-part } head?
|
||||
tracker_selection_menu-NECK = { -tracker_selection-part } neck?
|
||||
tracker_selection_menu-RIGHT_SHOULDER = { -tracker_selection-part } right shoulder?
|
||||
tracker_selection_menu-RIGHT_UPPER_ARM = { -tracker_selection-part } right upper arm?
|
||||
tracker_selection_menu-RIGHT_LOWER_ARM = { -tracker_selection-part } right lower arm?
|
||||
tracker_selection_menu-RIGHT_HAND = { -tracker_selection-part } right hand?
|
||||
tracker_selection_menu-RIGHT_UPPER_LEG = { -tracker_selection-part } right thigh?
|
||||
tracker_selection_menu-RIGHT_LOWER_LEG = { -tracker_selection-part } right ankle?
|
||||
tracker_selection_menu-RIGHT_FOOT = { -tracker_selection-part } right foot?
|
||||
tracker_selection_menu-UPPER_CHEST = { -tracker_selection-part } upper chest?
|
||||
tracker_selection_menu-CHEST = { -tracker_selection-part } chest?
|
||||
tracker_selection_menu-WAIST = { -tracker_selection-part } waist?
|
||||
tracker_selection_menu-HIP = { -tracker_selection-part } hip?
|
||||
tracker_selection_menu-LEFT_SHOULDER = { -tracker_selection-part } left shoulder?
|
||||
tracker_selection_menu-LEFT_UPPER_ARM = { -tracker_selection-part } left upper arm?
|
||||
tracker_selection_menu-LEFT_LOWER_ARM = { -tracker_selection-part } left lower arm?
|
||||
tracker_selection_menu-LEFT_HAND = { -tracker_selection-part } left hand?
|
||||
tracker_selection_menu-LEFT_UPPER_LEG = { -tracker_selection-part } left thigh?
|
||||
tracker_selection_menu-LEFT_LOWER_LEG = { -tracker_selection-part } left ankle?
|
||||
tracker_selection_menu-LEFT_FOOT = { -tracker_selection-part } left foot?
|
||||
tracker_selection_menu-LEFT_BIG_TOE = { -tracker_selection-part } left big toe?
|
||||
tracker_selection_menu-LEFT_INDEX_TOE = { -tracker_selection-part } left index toe?
|
||||
tracker_selection_menu-LEFT_MIDDLE_TOE = { -tracker_selection-part } left middle toe?
|
||||
tracker_selection_menu-LEFT_RING_TOE = { -tracker_selection-part } left ring toe?
|
||||
tracker_selection_menu-LEFT_LITTLE_TOE = { -tracker_selection-part } left little toe?
|
||||
tracker_selection_menu-RIGHT_BIG_TOE = { -tracker_selection-part } right big toe?
|
||||
tracker_selection_menu-RIGHT_INDEX_TOE = { -tracker_selection-part } right index toe?
|
||||
tracker_selection_menu-RIGHT_MIDDLE_TOE = { -tracker_selection-part } right middle toe?
|
||||
tracker_selection_menu-RIGHT_RING_TOE = { -tracker_selection-part } right ring toe?
|
||||
tracker_selection_menu-RIGHT_LITTLE_TOE = { -tracker_selection-part } right little toe?
|
||||
tracker_selection_menu-unassigned = Unassigned Trackers
|
||||
tracker_selection_menu-assigned = Assigned Trackers
|
||||
tracker_selection_menu-dont_assign = Unassign
|
||||
|
||||
# This line cares about multilines.
|
||||
# <b>text</b> means that the text should be bold.
|
||||
tracker_selection_menu-neck_warning =
|
||||
@@ -564,6 +654,7 @@ settings-stay_aligned-description = Stay Aligned reduces drift by gradually adju
|
||||
settings-stay_aligned-setup-label = Setup Stay Aligned
|
||||
settings-stay_aligned-setup-description = You must complete "Setup Stay Aligned" to enable Stay Aligned.
|
||||
settings-stay_aligned-enabled-label = Adjust trackers
|
||||
settings-stay_aligned-hide_yaw_correction-label = Hide adjustment (to compare without Stay Aligned)
|
||||
settings-stay_aligned-general-label = General
|
||||
settings-stay_aligned-relaxed_poses-label = Relaxed Poses
|
||||
settings-stay_aligned-relaxed_poses-description = Stay Aligned uses your relaxed poses to keep the trackers aligned. Use "Setup Stay Aligned" to update these poses.
|
||||
@@ -1189,6 +1280,42 @@ onboarding-assign_trackers-warning-WAIST = Waist is assigned but you need { $una
|
||||
*[unknown] Unknown unassigned body part
|
||||
} to also be assigned!
|
||||
|
||||
onboarding-assign_trackers-warning-LEFT_BIG_TOE = Left Big Toe is assigned but you need { $unassigned ->
|
||||
[0] the left foot
|
||||
*[unknown] Unknown unassigned body part
|
||||
} to also be assigned!
|
||||
onboarding-assign_trackers-warning-LEFT_INDEX_TOE = Left Index Toe is assigned but you need { $unassigned ->
|
||||
[0] the left foot
|
||||
*[unknown] Unknown unassigned body part
|
||||
} to also be assigned!
|
||||
onboarding-assign_trackers-warning-LEFT_MIDDLE_TOE = Left Middle Toe is assigned but you need { $unassigned ->
|
||||
[0] the left foot
|
||||
*[unknown] Unknown unassigned body part} to also be assigned!
|
||||
onboarding-assign_trackers-warning-LEFT_RING_TOE = Left Ring Toe is assigned but you need { $unassigned ->
|
||||
[0] the left foot
|
||||
*[unknown] Unknown unassigned body part} to also be assigned!
|
||||
onboarding-assign_trackers-warning-LEFT_LITTLE_TOE = Left Little Toe is assigned but you need { $unassigned ->
|
||||
[0] the left foot
|
||||
*[unknown] Unknown unassigned body part} to also be assigned!
|
||||
onboarding-assign_trackers-warning-RIGHT_BIG_TOE = Left Big Toe is assigned but you need { $unassigned ->
|
||||
[0] the right foot
|
||||
*[unknown] Unknown unassigned body part
|
||||
} to also be assigned!
|
||||
onboarding-assign_trackers-warning-RIGHT_INDEX_TOE = Right Index Toe is assigned but you need { $unassigned ->
|
||||
[0] the right foot
|
||||
*[unknown] Unknown unassigned body part
|
||||
} to also be assigned!
|
||||
onboarding-assign_trackers-warning-RIGHT_MIDDLE_TOE = Right Middle Toe is assigned but you need { $unassigned ->
|
||||
[0] the right foot
|
||||
*[unknown] Unknown unassigned body part} to also be assigned!
|
||||
onboarding-assign_trackers-warning-RIGHT_RING_TOE = Right Ring Toe is assigned but you need { $unassigned ->
|
||||
[0] the right foot
|
||||
*[unknown] Unknown unassigned body part} to also be assigned!
|
||||
onboarding-assign_trackers-warning-RIGHT_LITTLE_TOE = Right Little Toe is assigned but you need { $unassigned ->
|
||||
[0] the right foot
|
||||
*[unknown] Unknown unassigned body part} to also be assigned!
|
||||
|
||||
|
||||
## Tracker mounting method choose
|
||||
onboarding-choose_mounting = What mounting calibration method to use?
|
||||
# Multiline text
|
||||
@@ -1636,6 +1763,8 @@ toolbar-mounting_calibration-default = Body
|
||||
toolbar-mounting_calibration-feet = Feet
|
||||
toolbar-mounting_calibration-fingers = Fingers
|
||||
toolbar-drift_reset = Drift Reset
|
||||
toolbar-assigned_trackers = {$count} trackers assigned
|
||||
toolbar-unassigned_trackers = {$count} trackers unassigned
|
||||
toolbar-assigned_trackers = { $count ->
|
||||
[one] { $count } tracker assigned
|
||||
*[other] { $count } trackers assigned
|
||||
@@ -1644,3 +1773,17 @@ toolbar-unassigned_trackers = { $count ->
|
||||
[one] { $count } tracker unassigned
|
||||
*[other] { $count } trackers unassigned
|
||||
}
|
||||
toolbar-assigned_trackers = {$count} trackers assigned
|
||||
toolbar-unassigned_trackers = {$count} trackers unassigned
|
||||
body_part-LEFT_BIG_TOE = Left Big Toe
|
||||
body_part-LEFT_INDEX_TOE = Left Index Toe
|
||||
body_part-LEFT_MIDDLE_TOE = Left Middle Toe
|
||||
body_part-LEFT_RING_TOE = Left Ring Toe
|
||||
body_part-LEFT_LITTLE_TOE = Left Little Toe
|
||||
|
||||
body_part-RIGHT_TOES = Right Toes
|
||||
body_part-RIGHT_BIG_TOE = Right Big Toe
|
||||
body_part-RIGHT_INDEX_TOE = Right Index Toe
|
||||
body_part-RIGHT_MIDDLE_TOE = Right Middle Toe
|
||||
body_part-RIGHT_RING_TOE = Right Ring Toe
|
||||
body_part-RIGHT_LITTLE_TOE = Right Little Toe
|
||||
@@ -147,7 +147,7 @@ export function Toolbar() {
|
||||
|
||||
const { visibleGroups, groupVisibility } = useMemo(() => {
|
||||
const groupVisibility = Object.keys(BODY_PARTS_GROUPS)
|
||||
.filter((k) => ['fingers'].includes(k))
|
||||
.filter((k) => ['fingers', 'toes'].includes(k))
|
||||
.reduce(
|
||||
(curr, key) => {
|
||||
const group = key as MountingResetGroup;
|
||||
@@ -200,6 +200,13 @@ export function Toolbar() {
|
||||
group={'feet'}
|
||||
customName="toolbar-mounting_calibration-feet"
|
||||
/>
|
||||
{groupVisibility['toes'] && (
|
||||
<BasicResetButton
|
||||
type={ResetType.POSE_MOUNTING}
|
||||
group={'toes'}
|
||||
customName="toolbar-mounting_calibration-toes"
|
||||
/>
|
||||
)}
|
||||
{groupVisibility['fingers'] && (
|
||||
<BasicResetButton
|
||||
type={ResetType.POSE_MOUNTING}
|
||||
|
||||
@@ -168,8 +168,42 @@ export const mapPart: Record<
|
||||
<FingersIcon width={width} />
|
||||
),
|
||||
[BodyPart.RIGHT_LITTLE_DISTAL]: ({ width }) => <FingersIcon width={width} />,
|
||||
[BodyPart.LEFT_BIG_TOE]: renderFootLeft,
|
||||
[BodyPart.LEFT_INDEX_TOE]: renderFootLeft,
|
||||
[BodyPart.LEFT_MIDDLE_TOE]: renderFootLeft,
|
||||
[BodyPart.LEFT_RING_TOE]: renderFootLeft,
|
||||
[BodyPart.LEFT_LITTLE_TOE]: renderFootLeft,
|
||||
[BodyPart.RIGHT_BIG_TOE]: renderFootRight,
|
||||
[BodyPart.RIGHT_INDEX_TOE]: renderFootRight,
|
||||
[BodyPart.RIGHT_MIDDLE_TOE]: renderFootLeft,
|
||||
[BodyPart.RIGHT_RING_TOE]: renderFootLeft,
|
||||
[BodyPart.RIGHT_LITTLE_TOE]: renderFootRight,
|
||||
};
|
||||
export function renderFootLeft({
|
||||
width,
|
||||
currentLocales,
|
||||
}: {
|
||||
width?: number;
|
||||
currentLocales: string[];
|
||||
}) {
|
||||
if (currentLocales.includes('en-x-owo')) {
|
||||
return <PawIcon />;
|
||||
}
|
||||
return <FootIcon width={width} />;
|
||||
}
|
||||
|
||||
export function renderFootRight({
|
||||
width,
|
||||
currentLocales,
|
||||
}: {
|
||||
width?: number;
|
||||
currentLocales: string[];
|
||||
}) {
|
||||
if (currentLocales.includes('en-x-owo')) {
|
||||
return <PawIcon />;
|
||||
}
|
||||
return <FootIcon width={width} flipped />;
|
||||
}
|
||||
export function BodyPartIcon({
|
||||
bodyPart = BodyPart.NONE,
|
||||
width = 24,
|
||||
@@ -192,7 +226,7 @@ export function BodyPartIcon({
|
||||
) : (
|
||||
<svg width={width} height={width}>
|
||||
<rect width={width} height={width} rx="2" fill="#56407B" />
|
||||
{mapPart[bodyPart]({ width, currentLocales })}
|
||||
{mapPart[bodyPart]?.({ width, currentLocales })}
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -9,6 +9,9 @@ export const SIDES = [
|
||||
upperLeg: BodyPart.LEFT_UPPER_LEG,
|
||||
lowerLeg: BodyPart.LEFT_LOWER_LEG,
|
||||
foot: BodyPart.LEFT_FOOT,
|
||||
bigToe: BodyPart.LEFT_BIG_TOE,
|
||||
indexToe: BodyPart.LEFT_INDEX_TOE,
|
||||
littleToe: BodyPart.LEFT_LITTLE_TOE,
|
||||
},
|
||||
{
|
||||
shoulder: BodyPart.RIGHT_SHOULDER,
|
||||
@@ -18,6 +21,9 @@ export const SIDES = [
|
||||
upperLeg: BodyPart.RIGHT_UPPER_LEG,
|
||||
lowerLeg: BodyPart.RIGHT_LOWER_LEG,
|
||||
foot: BodyPart.RIGHT_FOOT,
|
||||
bigToe: BodyPart.RIGHT_BIG_TOE,
|
||||
indexToe: BodyPart.RIGHT_INDEX_TOE,
|
||||
littleToe: BodyPart.RIGHT_LITTLE_TOE,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -136,6 +142,14 @@ export function PersonFrontIcon({
|
||||
id={BodyPart[SIDES[right].foot]}
|
||||
/>
|
||||
|
||||
<circle
|
||||
className="body-part-circle"
|
||||
cx="102"
|
||||
cy="393"
|
||||
r={CIRCLE_RADIUS}
|
||||
id="right-toes"
|
||||
/>
|
||||
|
||||
<circle
|
||||
className="body-part-circle"
|
||||
cx="15"
|
||||
@@ -187,6 +201,13 @@ export function PersonFrontIcon({
|
||||
r={CIRCLE_RADIUS}
|
||||
id={BodyPart[SIDES[left].foot]}
|
||||
/>
|
||||
<circle
|
||||
className="body-part-circle"
|
||||
cx="62"
|
||||
cy="393"
|
||||
r={CIRCLE_RADIUS}
|
||||
id="left-toes"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -23,6 +23,7 @@ export function ResetButtonIcon(options: UseResetOptions) {
|
||||
if (options.type === ResetType.POSE_MOUNTING) {
|
||||
if (options.group === 'default') return <SkiIcon />;
|
||||
if (options.group === 'feet') return <FootIcon />;
|
||||
if (options.group === 'toes') return <FootIcon />;
|
||||
if (options.group === 'fingers') return <FingersIcon width={16} />;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,10 @@ import { BodyPart } from 'solarxr-protocol';
|
||||
import { PawIcon } from '@/components/commons/icon/PawIcon';
|
||||
import { useLocaleConfig } from '@/i18n/config';
|
||||
import { FingersIcon } from '@/components/commons/icon/FingersIcon';
|
||||
import {
|
||||
renderFootLeft,
|
||||
renderFootRight,
|
||||
} from '@/components/commons/BodyPartIcon';
|
||||
|
||||
// All body parts that are right or left, are by default left!
|
||||
export const mapPart: Record<
|
||||
@@ -148,6 +152,16 @@ export const mapPart: Record<
|
||||
<FingersIcon width={width} />
|
||||
),
|
||||
[BodyPart.RIGHT_LITTLE_DISTAL]: ({ width }) => <FingersIcon width={width} />,
|
||||
[BodyPart.LEFT_BIG_TOE]: renderFootLeft,
|
||||
[BodyPart.LEFT_INDEX_TOE]: renderFootLeft,
|
||||
[BodyPart.LEFT_MIDDLE_TOE]: renderFootLeft,
|
||||
[BodyPart.LEFT_RING_TOE]: renderFootLeft,
|
||||
[BodyPart.LEFT_LITTLE_TOE]: renderFootLeft,
|
||||
[BodyPart.RIGHT_BIG_TOE]: renderFootRight,
|
||||
[BodyPart.RIGHT_INDEX_TOE]: renderFootRight,
|
||||
[BodyPart.RIGHT_MIDDLE_TOE]: renderFootLeft,
|
||||
[BodyPart.RIGHT_RING_TOE]: renderFootLeft,
|
||||
[BodyPart.RIGHT_LITTLE_TOE]: renderFootRight,
|
||||
};
|
||||
|
||||
export function MountingBodyPartIcon({
|
||||
@@ -158,7 +172,9 @@ export function MountingBodyPartIcon({
|
||||
width?: number;
|
||||
}) {
|
||||
const { currentLocales } = useLocaleConfig();
|
||||
return mapPart[bodyPart]({ width, currentLocales });
|
||||
return (
|
||||
mapPart[bodyPart]?.({ width, currentLocales }) || <FootIcon width={width} />
|
||||
);
|
||||
}
|
||||
|
||||
function PieSliceOfFeet({
|
||||
|
||||
@@ -62,6 +62,15 @@ export const RIGHT_FINGER_BODY_PARTS = [
|
||||
BodyPart.RIGHT_LITTLE_INTERMEDIATE,
|
||||
BodyPart.RIGHT_LITTLE_DISTAL,
|
||||
];
|
||||
|
||||
export const TOE_BODY_PARTS = [
|
||||
BodyPart.LEFT_BIG_TOE,
|
||||
BodyPart.LEFT_INDEX_TOE,
|
||||
BodyPart.LEFT_LITTLE_TOE,
|
||||
BodyPart.RIGHT_BIG_TOE,
|
||||
BodyPart.RIGHT_INDEX_TOE,
|
||||
BodyPart.RIGHT_LITTLE_TOE,
|
||||
];
|
||||
export const FINGER_BODY_PARTS = [
|
||||
...LEFT_FINGER_BODY_PARTS,
|
||||
...RIGHT_FINGER_BODY_PARTS,
|
||||
|
||||
@@ -10,13 +10,13 @@ import {
|
||||
import { useWebsocketAPI } from './websocket-api';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { assignedTrackersAtom, serverGuardsAtom } from '@/store/app-store';
|
||||
import { FEET_BODY_PARTS, FINGER_BODY_PARTS } from './body-parts';
|
||||
import { FEET_BODY_PARTS, FINGER_BODY_PARTS, TOE_BODY_PARTS } from './body-parts';
|
||||
import { useLocaleConfig } from '@/i18n/config';
|
||||
import * as Sentry from '@sentry/react';
|
||||
|
||||
export type ResetBtnStatus = 'idle' | 'counting' | 'finished';
|
||||
|
||||
export type MountingResetGroup = 'default' | 'feet' | 'fingers';
|
||||
export type MountingResetGroup = 'default' | 'feet' | 'fingers' | 'toes';
|
||||
export type UseResetOptions =
|
||||
| { type: ResetType.FULL | ResetType.YAW }
|
||||
| { type: ResetType.POSE_MOUNTING; group: MountingResetGroup };
|
||||
@@ -24,6 +24,7 @@ export type UseResetOptions =
|
||||
export const BODY_PARTS_GROUPS: Record<MountingResetGroup, BodyPart[]> = {
|
||||
default: [],
|
||||
feet: FEET_BODY_PARTS,
|
||||
toes: TOE_BODY_PARTS,
|
||||
fingers: FINGER_BODY_PARTS,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
import { useLocalization } from '@fluent/react';
|
||||
import {
|
||||
createContext,
|
||||
useContext,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useState,
|
||||
} from 'react';
|
||||
import { createContext, useContext, useEffect, useMemo, useState } from 'react';
|
||||
import {
|
||||
AssignTrackerRequestT,
|
||||
BodyPart,
|
||||
|
||||
@@ -239,6 +239,17 @@ export class BoneKind extends Bone {
|
||||
case BodyPart.RIGHT_LITTLE_INTERMEDIATE:
|
||||
case BodyPart.RIGHT_LITTLE_DISTAL:
|
||||
return new Color('pink');
|
||||
case BodyPart.LEFT_BIG_TOE:
|
||||
case BodyPart.LEFT_INDEX_TOE:
|
||||
case BodyPart.LEFT_MIDDLE_TOE:
|
||||
case BodyPart.LEFT_RING_TOE:
|
||||
case BodyPart.LEFT_LITTLE_TOE:
|
||||
case BodyPart.RIGHT_BIG_TOE:
|
||||
case BodyPart.RIGHT_INDEX_TOE:
|
||||
case BodyPart.RIGHT_MIDDLE_TOE:
|
||||
case BodyPart.RIGHT_RING_TOE:
|
||||
case BodyPart.RIGHT_LITTLE_TOE:
|
||||
return new Color('pink');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,10 +285,21 @@ export class BoneKind extends Bone {
|
||||
case BodyPart.RIGHT_LOWER_LEG:
|
||||
return [BodyPart.RIGHT_FOOT];
|
||||
case BodyPart.LEFT_FOOT:
|
||||
return [];
|
||||
return [
|
||||
BodyPart.LEFT_BIG_TOE,
|
||||
BodyPart.LEFT_INDEX_TOE,
|
||||
BodyPart.LEFT_MIDDLE_TOE,
|
||||
BodyPart.LEFT_RING_TOE,
|
||||
BodyPart.LEFT_LITTLE_TOE,
|
||||
];
|
||||
case BodyPart.RIGHT_FOOT:
|
||||
return [];
|
||||
|
||||
return [
|
||||
BodyPart.RIGHT_BIG_TOE,
|
||||
BodyPart.RIGHT_INDEX_TOE,
|
||||
BodyPart.RIGHT_MIDDLE_TOE,
|
||||
BodyPart.RIGHT_RING_TOE,
|
||||
BodyPart.RIGHT_LITTLE_TOE,
|
||||
];
|
||||
case BodyPart.LEFT_SHOULDER:
|
||||
return [BodyPart.LEFT_UPPER_ARM];
|
||||
case BodyPart.RIGHT_SHOULDER:
|
||||
@@ -367,6 +389,18 @@ export class BoneKind extends Bone {
|
||||
return [BodyPart.RIGHT_LITTLE_DISTAL];
|
||||
case BodyPart.RIGHT_LITTLE_DISTAL:
|
||||
return [];
|
||||
return [];
|
||||
case BodyPart.LEFT_BIG_TOE:
|
||||
case BodyPart.LEFT_INDEX_TOE:
|
||||
case BodyPart.LEFT_MIDDLE_TOE:
|
||||
case BodyPart.LEFT_RING_TOE:
|
||||
case BodyPart.LEFT_LITTLE_TOE:
|
||||
case BodyPart.RIGHT_BIG_TOE:
|
||||
case BodyPart.RIGHT_INDEX_TOE:
|
||||
case BodyPart.RIGHT_MIDDLE_TOE:
|
||||
case BodyPart.RIGHT_RING_TOE:
|
||||
case BodyPart.RIGHT_LITTLE_TOE:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -479,6 +513,27 @@ export class BoneKind extends Bone {
|
||||
return BodyPart.RIGHT_LITTLE_PROXIMAL;
|
||||
case BodyPart.RIGHT_LITTLE_DISTAL:
|
||||
return BodyPart.RIGHT_LITTLE_INTERMEDIATE;
|
||||
|
||||
case BodyPart.LEFT_BIG_TOE:
|
||||
return BodyPart.LEFT_FOOT;
|
||||
case BodyPart.LEFT_INDEX_TOE:
|
||||
return BodyPart.LEFT_FOOT;
|
||||
case BodyPart.LEFT_MIDDLE_TOE:
|
||||
return BodyPart.LEFT_FOOT;
|
||||
case BodyPart.LEFT_RING_TOE:
|
||||
return BodyPart.LEFT_FOOT;
|
||||
case BodyPart.LEFT_LITTLE_TOE:
|
||||
return BodyPart.LEFT_FOOT;
|
||||
case BodyPart.RIGHT_BIG_TOE:
|
||||
return BodyPart.RIGHT_FOOT;
|
||||
case BodyPart.RIGHT_INDEX_TOE:
|
||||
return BodyPart.RIGHT_FOOT;
|
||||
case BodyPart.RIGHT_MIDDLE_TOE:
|
||||
return BodyPart.RIGHT_FOOT;
|
||||
case BodyPart.RIGHT_RING_TOE:
|
||||
return BodyPart.RIGHT_FOOT;
|
||||
case BodyPart.RIGHT_LITTLE_TOE:
|
||||
return BodyPart.RIGHT_FOOT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,6 +197,17 @@ export const SKELETON_PART_PRESETS: Record<BodyPart, BonePartConfig> = {
|
||||
[BodyPart.RIGHT_LITTLE_PROXIMAL]: finger(),
|
||||
[BodyPart.RIGHT_LITTLE_INTERMEDIATE]: finger(),
|
||||
[BodyPart.RIGHT_LITTLE_DISTAL]: finger(),
|
||||
|
||||
[BodyPart.LEFT_BIG_TOE]: finger(),
|
||||
[BodyPart.LEFT_INDEX_TOE]: finger(),
|
||||
[BodyPart.LEFT_MIDDLE_TOE]: finger(),
|
||||
[BodyPart.LEFT_RING_TOE]: finger(),
|
||||
[BodyPart.LEFT_LITTLE_TOE]: finger(),
|
||||
[BodyPart.RIGHT_BIG_TOE]: finger(),
|
||||
[BodyPart.RIGHT_MIDDLE_TOE]: finger(),
|
||||
[BodyPart.RIGHT_INDEX_TOE]: finger(),
|
||||
[BodyPart.RIGHT_RING_TOE]: finger(),
|
||||
[BodyPart.RIGHT_LITTLE_TOE]: finger(),
|
||||
};
|
||||
|
||||
export function computeShapeScale(
|
||||
|
||||
@@ -8,10 +8,27 @@ object ResetBodyParts {
|
||||
BodyPart.RIGHT_UPPER_LEG,
|
||||
)
|
||||
|
||||
val LEFT_TOES = setOf(
|
||||
BodyPart.LEFT_BIG_TOE,
|
||||
BodyPart.LEFT_INDEX_TOE,
|
||||
BodyPart.LEFT_MIDDLE_TOE,
|
||||
BodyPart.LEFT_RING_TOE,
|
||||
BodyPart.LEFT_LITTLE_TOE,
|
||||
)
|
||||
val RIGHT_TOES = setOf(
|
||||
BodyPart.RIGHT_BIG_TOE,
|
||||
BodyPart.RIGHT_INDEX_TOE,
|
||||
BodyPart.RIGHT_MIDDLE_TOE,
|
||||
BodyPart.RIGHT_RING_TOE,
|
||||
BodyPart.RIGHT_LITTLE_TOE,
|
||||
)
|
||||
|
||||
val FEET = setOf(
|
||||
BodyPart.LEFT_FOOT,
|
||||
BodyPart.RIGHT_FOOT,
|
||||
)
|
||||
) +
|
||||
LEFT_TOES +
|
||||
RIGHT_TOES
|
||||
|
||||
val LEFT_FINGERS = setOf(
|
||||
BodyPart.LEFT_THUMB_METACARPAL,
|
||||
|
||||
@@ -63,6 +63,22 @@ val BODY_PART_HIERARCHY_MAP: BodyPartMap<Array<BodyPart>> = BodyPartMap(
|
||||
BodyPart.RIGHT_HIP to arrayOf(BodyPart.RIGHT_UPPER_LEG),
|
||||
BodyPart.RIGHT_UPPER_LEG to arrayOf(BodyPart.RIGHT_LOWER_LEG),
|
||||
BodyPart.RIGHT_LOWER_LEG to arrayOf(BodyPart.RIGHT_FOOT),
|
||||
|
||||
BodyPart.LEFT_FOOT to arrayOf(
|
||||
BodyPart.LEFT_BIG_TOE,
|
||||
BodyPart.LEFT_INDEX_TOE,
|
||||
BodyPart.LEFT_MIDDLE_TOE,
|
||||
BodyPart.LEFT_RING_TOE,
|
||||
BodyPart.LEFT_LITTLE_TOE,
|
||||
),
|
||||
|
||||
BodyPart.RIGHT_FOOT to arrayOf(
|
||||
BodyPart.RIGHT_BIG_TOE,
|
||||
BodyPart.RIGHT_INDEX_TOE,
|
||||
BodyPart.RIGHT_MIDDLE_TOE,
|
||||
BodyPart.RIGHT_RING_TOE,
|
||||
BodyPart.RIGHT_LITTLE_TOE,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package dev.slimevr.skeleton.processors
|
||||
|
||||
import dev.slimevr.skeleton.BodyPartMap
|
||||
import dev.slimevr.skeleton.InputSkeleton
|
||||
import dev.slimevr.skeleton.SkeletonInputProcessor
|
||||
import dev.slimevr.skeleton.SkeletonState
|
||||
import dev.slimevr.skeleton.mutateCopy
|
||||
import solarxr_protocol.datatypes.BodyPart
|
||||
|
||||
/**
|
||||
* Handles rotations of inactive toe bones.
|
||||
*/
|
||||
class ToeDirectLinkInputProcessor : SkeletonInputProcessor {
|
||||
/**
|
||||
* First element is the linked BodyPart.
|
||||
*
|
||||
* Second element is the BodyPart the first element is linked to.
|
||||
*/
|
||||
private val toesToSource = arrayOf(
|
||||
BodyPart.LEFT_BIG_TOE to BodyPart.LEFT_FOOT,
|
||||
BodyPart.LEFT_INDEX_TOE to BodyPart.LEFT_BIG_TOE,
|
||||
BodyPart.LEFT_MIDDLE_TOE to BodyPart.LEFT_INDEX_TOE,
|
||||
BodyPart.LEFT_RING_TOE to BodyPart.LEFT_MIDDLE_TOE,
|
||||
BodyPart.LEFT_LITTLE_TOE to BodyPart.LEFT_RING_TOE,
|
||||
|
||||
BodyPart.RIGHT_BIG_TOE to BodyPart.RIGHT_FOOT,
|
||||
BodyPart.RIGHT_INDEX_TOE to BodyPart.RIGHT_BIG_TOE,
|
||||
BodyPart.RIGHT_MIDDLE_TOE to BodyPart.RIGHT_INDEX_TOE,
|
||||
BodyPart.RIGHT_RING_TOE to BodyPart.RIGHT_MIDDLE_TOE,
|
||||
BodyPart.RIGHT_LITTLE_TOE to BodyPart.RIGHT_RING_TOE,
|
||||
)
|
||||
|
||||
override fun process(inputSkeleton: InputSkeleton, skeletonHeight: Float): InputSkeleton {
|
||||
return inputSkeleton.mutateCopy{ updated ->
|
||||
for ((bodyPart, source) in toesToSource) {
|
||||
val bone = updated.getValue(bodyPart)
|
||||
if (bone.isRotationActive) continue
|
||||
val sourceBone = updated[source]
|
||||
updated[bodyPart] =
|
||||
bone.copy(rawRotation = sourceBone?.rawRotation ?: bone.rawRotation)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import dev.slimevr.skeleton.inputprocessors.HeadPositionFallbackProcessor
|
||||
import dev.slimevr.skeleton.inputprocessors.HipYawRollAlignInputProcessor
|
||||
import dev.slimevr.skeleton.inputprocessors.SpineImputeInputProcessor
|
||||
import dev.slimevr.skeleton.inputprocessors.UpperLegsRollAlignInputProcessor
|
||||
import dev.slimevr.skeleton.processors.ToeDirectLinkInputProcessor
|
||||
import io.github.axisangles.ktmath.Quaternion
|
||||
import io.github.axisangles.ktmath.Vector3
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
@@ -188,6 +189,7 @@ class Skeleton(
|
||||
UpperLegsRollAlignInputProcessor(settings),
|
||||
BoneDirectLinkInputProcessor(),
|
||||
FingerImputeInputProcessor(),
|
||||
ToeDirectLinkInputProcessor(),
|
||||
BonePredictionInputProcessor(settings),
|
||||
BoneSmoothingInputProcessor(settings),
|
||||
),
|
||||
|
||||
@@ -118,6 +118,8 @@ fun Map<SkeletonBone, Float>.toBoneOffsets(): BodyPartMap<Vector3> {
|
||||
}
|
||||
// Fingers
|
||||
this[SkeletonBone.HAND_Y]?.let { offsets.putAll(getFingerOffsets(it)) }
|
||||
// Toes
|
||||
this[SkeletonBone.FOOT_LENGTH]?.let { offsets.putAll(getToeOffsets(it)) }
|
||||
return offsets
|
||||
}
|
||||
|
||||
@@ -206,3 +208,13 @@ private fun getFingerOffsets(handLength: Float) = (
|
||||
private const val PROXIMAL_RATIO = 0.5f
|
||||
private const val INTERMEDIATE_RATIO = 0.283f
|
||||
private const val DISTAL_RATIO = 0.217f
|
||||
|
||||
/**
|
||||
* Returns the offsets for the toe bones scaled from the handLength.
|
||||
*/
|
||||
private fun getToeOffsets(footLength: Float) = (
|
||||
iterateBodyPartHierarchy(BodyPart.LEFT_FOOT, true) +
|
||||
iterateBodyPartHierarchy(BodyPart.RIGHT_FOOT, true)
|
||||
).map { it.second }.associateWith {
|
||||
Vector3(0f, 0f, -footLength * 0.2f)
|
||||
}
|
||||
@@ -8,58 +8,68 @@ import io.github.axisangles.ktmath.Quaternion
|
||||
import io.github.axisangles.ktmath.Vector3
|
||||
import solarxr_protocol.datatypes.BodyPart
|
||||
|
||||
val BODY_PART_TO_UNITY_BONE: BodyPartMap<String> = BodyPartMap(
|
||||
val BODY_PART_TO_UNITY_BONE: BodyPartMap<Array<String>> = BodyPartMap(
|
||||
mapOf(
|
||||
BodyPart.HEAD to "Head",
|
||||
BodyPart.NECK to "Neck",
|
||||
BodyPart.UPPER_CHEST to "UpperChest",
|
||||
BodyPart.CHEST to "Chest",
|
||||
BodyPart.WAIST to "Spine",
|
||||
BodyPart.HIP to "Hips",
|
||||
BodyPart.LEFT_SHOULDER to "LeftShoulder",
|
||||
BodyPart.RIGHT_SHOULDER to "RightShoulder",
|
||||
BodyPart.LEFT_UPPER_ARM to "LeftUpperArm",
|
||||
BodyPart.RIGHT_UPPER_ARM to "RightUpperArm",
|
||||
BodyPart.LEFT_LOWER_ARM to "LeftLowerArm",
|
||||
BodyPart.RIGHT_LOWER_ARM to "RightLowerArm",
|
||||
BodyPart.LEFT_HAND to "LeftHand",
|
||||
BodyPart.RIGHT_HAND to "RightHand",
|
||||
BodyPart.LEFT_UPPER_LEG to "LeftUpperLeg",
|
||||
BodyPart.RIGHT_UPPER_LEG to "RightUpperLeg",
|
||||
BodyPart.LEFT_LOWER_LEG to "LeftLowerLeg",
|
||||
BodyPart.RIGHT_LOWER_LEG to "RightLowerLeg",
|
||||
BodyPart.LEFT_FOOT to "LeftFoot",
|
||||
BodyPart.RIGHT_FOOT to "RightFoot",
|
||||
BodyPart.LEFT_THUMB_METACARPAL to "LeftThumbProximal",
|
||||
BodyPart.LEFT_THUMB_PROXIMAL to "LeftThumbIntermediate",
|
||||
BodyPart.LEFT_THUMB_DISTAL to "LeftThumbDistal",
|
||||
BodyPart.LEFT_INDEX_PROXIMAL to "LeftIndexProximal",
|
||||
BodyPart.LEFT_INDEX_INTERMEDIATE to "LeftIndexIntermediate",
|
||||
BodyPart.LEFT_INDEX_DISTAL to "LeftIndexDistal",
|
||||
BodyPart.LEFT_MIDDLE_PROXIMAL to "LeftMiddleProximal",
|
||||
BodyPart.LEFT_MIDDLE_INTERMEDIATE to "LeftMiddleIntermediate",
|
||||
BodyPart.LEFT_MIDDLE_DISTAL to "LeftMiddleDistal",
|
||||
BodyPart.LEFT_RING_PROXIMAL to "LeftRingProximal",
|
||||
BodyPart.LEFT_RING_INTERMEDIATE to "LeftRingIntermediate",
|
||||
BodyPart.LEFT_RING_DISTAL to "LeftRingDistal",
|
||||
BodyPart.LEFT_LITTLE_PROXIMAL to "LeftLittleProximal",
|
||||
BodyPart.LEFT_LITTLE_INTERMEDIATE to "LeftLittleIntermediate",
|
||||
BodyPart.LEFT_LITTLE_DISTAL to "LeftLittleDistal",
|
||||
BodyPart.RIGHT_THUMB_METACARPAL to "RightThumbProximal",
|
||||
BodyPart.RIGHT_THUMB_PROXIMAL to "RightThumbIntermediate",
|
||||
BodyPart.RIGHT_THUMB_DISTAL to "RightThumbDistal",
|
||||
BodyPart.RIGHT_INDEX_PROXIMAL to "RightIndexProximal",
|
||||
BodyPart.RIGHT_INDEX_INTERMEDIATE to "RightIndexIntermediate",
|
||||
BodyPart.RIGHT_INDEX_DISTAL to "RightIndexDistal",
|
||||
BodyPart.RIGHT_MIDDLE_PROXIMAL to "RightMiddleProximal",
|
||||
BodyPart.RIGHT_MIDDLE_INTERMEDIATE to "RightMiddleIntermediate",
|
||||
BodyPart.RIGHT_MIDDLE_DISTAL to "RightMiddleDistal",
|
||||
BodyPart.RIGHT_RING_PROXIMAL to "RightRingProximal",
|
||||
BodyPart.RIGHT_RING_INTERMEDIATE to "RightRingIntermediate",
|
||||
BodyPart.RIGHT_RING_DISTAL to "RightRingDistal",
|
||||
BodyPart.RIGHT_LITTLE_PROXIMAL to "RightLittleProximal",
|
||||
BodyPart.RIGHT_LITTLE_INTERMEDIATE to "RightLittleIntermediate",
|
||||
BodyPart.RIGHT_LITTLE_DISTAL to "RightLittleDistal",
|
||||
BodyPart.HEAD to arrayOf("Head"),
|
||||
BodyPart.NECK to arrayOf("Neck"),
|
||||
BodyPart.UPPER_CHEST to arrayOf("UpperChest"),
|
||||
BodyPart.CHEST to arrayOf("Chest"),
|
||||
BodyPart.WAIST to arrayOf("Spine"),
|
||||
BodyPart.HIP to arrayOf("Hips"),
|
||||
BodyPart.LEFT_SHOULDER to arrayOf("LeftShoulder"),
|
||||
BodyPart.RIGHT_SHOULDER to arrayOf("RightShoulder"),
|
||||
BodyPart.LEFT_UPPER_ARM to arrayOf("LeftUpperArm"),
|
||||
BodyPart.RIGHT_UPPER_ARM to arrayOf("RightUpperArm"),
|
||||
BodyPart.LEFT_LOWER_ARM to arrayOf("LeftLowerArm"),
|
||||
BodyPart.RIGHT_LOWER_ARM to arrayOf("RightLowerArm"),
|
||||
BodyPart.LEFT_HAND to arrayOf("LeftHand"),
|
||||
BodyPart.RIGHT_HAND to arrayOf("RightHand"),
|
||||
BodyPart.LEFT_UPPER_LEG to arrayOf("LeftUpperLeg"),
|
||||
BodyPart.RIGHT_UPPER_LEG to arrayOf("RightUpperLeg"),
|
||||
BodyPart.LEFT_LOWER_LEG to arrayOf("LeftLowerLeg"),
|
||||
BodyPart.RIGHT_LOWER_LEG to arrayOf("RightLowerLeg"),
|
||||
BodyPart.LEFT_FOOT to arrayOf("LeftFoot"),
|
||||
BodyPart.RIGHT_FOOT to arrayOf("RightFoot"),
|
||||
BodyPart.LEFT_THUMB_METACARPAL to arrayOf("LeftThumbProximal"),
|
||||
BodyPart.LEFT_THUMB_PROXIMAL to arrayOf("LeftThumbIntermediate"),
|
||||
BodyPart.LEFT_THUMB_DISTAL to arrayOf("LeftThumbDistal"),
|
||||
BodyPart.LEFT_INDEX_PROXIMAL to arrayOf("LeftIndexProximal"),
|
||||
BodyPart.LEFT_INDEX_INTERMEDIATE to arrayOf("LeftIndexIntermediate"),
|
||||
BodyPart.LEFT_INDEX_DISTAL to arrayOf("LeftIndexDistal"),
|
||||
BodyPart.LEFT_MIDDLE_PROXIMAL to arrayOf("LeftMiddleProximal"),
|
||||
BodyPart.LEFT_MIDDLE_INTERMEDIATE to arrayOf("LeftMiddleIntermediate"),
|
||||
BodyPart.LEFT_MIDDLE_DISTAL to arrayOf("LeftMiddleDistal"),
|
||||
BodyPart.LEFT_RING_PROXIMAL to arrayOf("LeftRingProximal"),
|
||||
BodyPart.LEFT_RING_INTERMEDIATE to arrayOf("LeftRingIntermediate"),
|
||||
BodyPart.LEFT_RING_DISTAL to arrayOf("LeftRingDistal"),
|
||||
BodyPart.LEFT_LITTLE_PROXIMAL to arrayOf("LeftLittleProximal"),
|
||||
BodyPart.LEFT_LITTLE_INTERMEDIATE to arrayOf("LeftLittleIntermediate"),
|
||||
BodyPart.LEFT_LITTLE_DISTAL to arrayOf("LeftLittleDistal"),
|
||||
BodyPart.RIGHT_THUMB_METACARPAL to arrayOf("RightThumbProximal"),
|
||||
BodyPart.RIGHT_THUMB_PROXIMAL to arrayOf("RightThumbIntermediate"),
|
||||
BodyPart.RIGHT_THUMB_DISTAL to arrayOf("RightThumbDistal"),
|
||||
BodyPart.RIGHT_INDEX_PROXIMAL to arrayOf("RightIndexProximal"),
|
||||
BodyPart.RIGHT_INDEX_INTERMEDIATE to arrayOf("RightIndexIntermediate"),
|
||||
BodyPart.RIGHT_INDEX_DISTAL to arrayOf("RightIndexDistal"),
|
||||
BodyPart.RIGHT_MIDDLE_PROXIMAL to arrayOf("RightMiddleProximal"),
|
||||
BodyPart.RIGHT_MIDDLE_INTERMEDIATE to arrayOf("RightMiddleIntermediate"),
|
||||
BodyPart.RIGHT_MIDDLE_DISTAL to arrayOf("RightMiddleDistal"),
|
||||
BodyPart.RIGHT_RING_PROXIMAL to arrayOf("RightRingProximal"),
|
||||
BodyPart.RIGHT_RING_INTERMEDIATE to arrayOf("RightRingIntermediate"),
|
||||
BodyPart.RIGHT_RING_DISTAL to arrayOf("RightRingDistal"),
|
||||
BodyPart.RIGHT_LITTLE_PROXIMAL to arrayOf("RightLittleProximal"),
|
||||
BodyPart.RIGHT_LITTLE_INTERMEDIATE to arrayOf("RightLittleIntermediate"),
|
||||
BodyPart.RIGHT_LITTLE_DISTAL to arrayOf("RightLittleDistal"),
|
||||
BodyPart.LEFT_BIG_TOE to arrayOf("LeftToes", "LeftBigToe"),
|
||||
BodyPart.LEFT_INDEX_TOE to arrayOf("LeftIndexToe"),
|
||||
BodyPart.LEFT_MIDDLE_TOE to arrayOf("LeftMiddleToe"),
|
||||
BodyPart.LEFT_RING_TOE to arrayOf("LeftRingToe"),
|
||||
BodyPart.LEFT_LITTLE_TOE to arrayOf("LeftLittleToe"),
|
||||
BodyPart.RIGHT_BIG_TOE to arrayOf("RightToes", "RightBigToe"),
|
||||
BodyPart.RIGHT_INDEX_TOE to arrayOf("RightIndexToe"),
|
||||
BodyPart.RIGHT_MIDDLE_TOE to arrayOf("RightMiddleToe"),
|
||||
BodyPart.RIGHT_RING_TOE to arrayOf("RightRingToe"),
|
||||
BodyPart.RIGHT_LITTLE_TOE to arrayOf("RightLittleToe"),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -119,6 +129,20 @@ val VMC_HIERARCHY_MAP: BodyPartMap<Array<BodyPart>> = BodyPartMap(
|
||||
BodyPart.RIGHT_RING_INTERMEDIATE to arrayOf(BodyPart.RIGHT_RING_DISTAL),
|
||||
BodyPart.RIGHT_LITTLE_PROXIMAL to arrayOf(BodyPart.RIGHT_LITTLE_INTERMEDIATE),
|
||||
BodyPart.RIGHT_LITTLE_INTERMEDIATE to arrayOf(BodyPart.RIGHT_LITTLE_DISTAL),
|
||||
BodyPart.LEFT_FOOT to arrayOf(
|
||||
BodyPart.LEFT_BIG_TOE,
|
||||
BodyPart.LEFT_INDEX_TOE,
|
||||
BodyPart.LEFT_MIDDLE_TOE,
|
||||
BodyPart.LEFT_RING_TOE,
|
||||
BodyPart.LEFT_LITTLE_TOE,
|
||||
),
|
||||
BodyPart.RIGHT_FOOT to arrayOf(
|
||||
BodyPart.RIGHT_BIG_TOE,
|
||||
BodyPart.RIGHT_INDEX_TOE,
|
||||
BodyPart.RIGHT_MIDDLE_TOE,
|
||||
BodyPart.RIGHT_RING_TOE,
|
||||
BodyPart.RIGHT_LITTLE_TOE,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -155,6 +179,12 @@ val VMC_MIRROR_BONE_PAIRS: List<Pair<BodyPart, BodyPart>> = listOf(
|
||||
BodyPart.LEFT_LITTLE_PROXIMAL to BodyPart.RIGHT_LITTLE_PROXIMAL,
|
||||
BodyPart.LEFT_LITTLE_INTERMEDIATE to BodyPart.RIGHT_LITTLE_INTERMEDIATE,
|
||||
BodyPart.LEFT_LITTLE_DISTAL to BodyPart.RIGHT_LITTLE_DISTAL,
|
||||
BodyPart.LEFT_BIG_TOE to BodyPart.RIGHT_BIG_TOE,
|
||||
BodyPart.LEFT_BIG_TOE to BodyPart.RIGHT_BIG_TOE,
|
||||
BodyPart.LEFT_INDEX_TOE to BodyPart.RIGHT_INDEX_TOE,
|
||||
BodyPart.LEFT_MIDDLE_TOE to BodyPart.RIGHT_MIDDLE_TOE,
|
||||
BodyPart.LEFT_RING_TOE to BodyPart.RIGHT_RING_TOE,
|
||||
BodyPart.LEFT_LITTLE_TOE to BodyPart.RIGHT_LITTLE_TOE,
|
||||
)
|
||||
|
||||
val VMC_MIRROR_BONES: BodyPartMap<BodyPart> = BodyPartMap(
|
||||
|
||||
@@ -27,7 +27,7 @@ internal fun buildOutgoingBundle(
|
||||
add(OscContent.Message(transformMessage("/VMC/Ext/Root/Pos", "root", Vector3.NULL, Quaternion.IDENTITY)))
|
||||
|
||||
// TODO UpperChest + shoulders affecting arms local rot
|
||||
for ((targetBodyPart, unityName) in BODY_PART_TO_UNITY_BONE) {
|
||||
for ((targetBodyPart, unityNames) in BODY_PART_TO_UNITY_BONE) {
|
||||
if (targetBodyPart !in routedBones) continue
|
||||
|
||||
val targetParentBodyPart = VMC_BONE_PARENTS[targetBodyPart]
|
||||
@@ -38,7 +38,7 @@ internal fun buildOutgoingBundle(
|
||||
// TODO anchorHip https://github.com/SlimeVR/SlimeVR-Server/blob/main/server/core/src/main/java/dev/slimevr/osc/VMCHandler.kt#L371
|
||||
val pos = vrm?.hipLocalPosition ?: Vector3.NULL
|
||||
val rot = vmcLocalRotation(trackingBone, null, targetBodyPart, null, config.mirrorTracking)
|
||||
add(OscContent.Message(transformMessage("/VMC/Ext/Bone/Pos", unityName, pos, rot)))
|
||||
add(OscContent.Message(transformMessage("/VMC/Ext/Bone/Pos", unityNames.first(), pos, rot)))
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -61,7 +61,9 @@ internal fun buildOutgoingBundle(
|
||||
targetParentBodyPart,
|
||||
config.mirrorTracking,
|
||||
)
|
||||
add(OscContent.Message(transformMessage("/VMC/Ext/Bone/Pos", unityName, pos, rot)))
|
||||
for (outputName in unityNames) {
|
||||
add(OscContent.Message(transformMessage("/VMC/Ext/Bone/Pos", outputName, pos, rot)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ data class VrmGeometry(
|
||||
|
||||
fun buildVrmGeometry(reader: VrmReader): VrmGeometry {
|
||||
val bindOffsets = BodyPartMap(
|
||||
BODY_PART_TO_UNITY_BONE.mapValues { (_, unityName) -> reader.offsetForBone(unityName) ?: Vector3.NULL },
|
||||
BODY_PART_TO_UNITY_BONE.mapValues { (_, unityNames) -> reader.offsetForBone(unityNames.first()) ?: Vector3.NULL },
|
||||
)
|
||||
fun offset(bodyPart: BodyPart) = bindOffsets[bodyPart] ?: Vector3.NULL
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ internal fun buildOutgoingBundle(
|
||||
bones: ComputedSkeleton,
|
||||
routedBones: Set<BodyPart>,
|
||||
): OscBundle? {
|
||||
val messages = buildList {
|
||||
val messages = buildList<OscContent> {
|
||||
for ((bodyPart, trackerId) in trackerIdsByBodyPart) {
|
||||
if (bodyPart !in routedBones) continue
|
||||
|
||||
@@ -54,6 +54,8 @@ internal fun buildOutgoingBundle(
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
addAll(buildToeMessages(bones))
|
||||
}
|
||||
|
||||
return messages.takeIf { it.isNotEmpty() }?.let { OscBundle(1L, it) }
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
package dev.slimevr.vrcosc
|
||||
|
||||
import dev.slimevr.osc.OscArg
|
||||
import dev.slimevr.osc.OscContent
|
||||
import dev.slimevr.osc.OscMessage
|
||||
import dev.slimevr.skeleton.BoneState
|
||||
import dev.slimevr.util.Side
|
||||
import dev.slimevr.util.opposite
|
||||
import io.github.axisangles.ktmath.EulerOrder
|
||||
import io.github.axisangles.ktmath.Quaternion
|
||||
import io.github.axisangles.ktmath.Vector3
|
||||
import solarxr_protocol.datatypes.BodyPart
|
||||
import kotlin.math.*
|
||||
|
||||
private const val ABSOLUTE_SPLAY_THRESHOLD_ANGLE = 7
|
||||
private const val MINIMUM_TIP_TOE_PITCH = -14
|
||||
private const val MINIMUM_BENDING_PITCH = 15
|
||||
private const val MAXIMUM_ABSOLUTE_TOE_RANGE = 90
|
||||
|
||||
internal fun buildToeMessages(bones: Map<BodyPart, BoneState>): List<OscContent> {
|
||||
val messages = mutableListOf<OscContent>()
|
||||
|
||||
// LEFT FOOT + TOES
|
||||
val leftFoot = bones[BodyPart.LEFT_FOOT]
|
||||
if (leftFoot != null) {
|
||||
val leftToes = listOf(
|
||||
bones[BodyPart.LEFT_BIG_TOE],
|
||||
bones[BodyPart.LEFT_INDEX_TOE],
|
||||
bones[BodyPart.LEFT_MIDDLE_TOE],
|
||||
bones[BodyPart.LEFT_RING_TOE],
|
||||
bones[BodyPart.LEFT_LITTLE_TOE],
|
||||
)
|
||||
processToesForFoot(leftFoot, leftToes, Side.LEFT, messages)
|
||||
}
|
||||
|
||||
// RIGHT FOOT + TOES
|
||||
val rightFoot = bones[BodyPart.RIGHT_FOOT]
|
||||
if (rightFoot != null) {
|
||||
val rightToes = listOf(
|
||||
bones[BodyPart.RIGHT_BIG_TOE],
|
||||
bones[BodyPart.RIGHT_INDEX_TOE],
|
||||
bones[BodyPart.RIGHT_MIDDLE_TOE],
|
||||
bones[BodyPart.RIGHT_RING_TOE],
|
||||
bones[BodyPart.RIGHT_LITTLE_TOE],
|
||||
)
|
||||
processToesForFoot(rightFoot, rightToes, Side.RIGHT, messages)
|
||||
}
|
||||
|
||||
return messages
|
||||
}
|
||||
|
||||
private fun processToesForFoot(
|
||||
foot: BoneState,
|
||||
toeBones: List<BoneState?>,
|
||||
side: Side,
|
||||
messages: MutableList<OscContent>,
|
||||
) {
|
||||
var lastAssigned: BoneState? = null
|
||||
|
||||
for ((segmentIndex, toe) in toeBones.withIndex()) {
|
||||
if (toe != null) {
|
||||
lastAssigned = toe
|
||||
}
|
||||
|
||||
if (lastAssigned == null) continue
|
||||
|
||||
val splayDirection = if (segmentIndex > 0) side else side.opposite
|
||||
|
||||
processToe(foot, lastAssigned, side, segmentIndex, splayDirection, messages)
|
||||
}
|
||||
}
|
||||
|
||||
private val Side.oscName: String
|
||||
get() = when (this) {
|
||||
Side.LEFT -> "Left"
|
||||
Side.RIGHT -> "Right"
|
||||
}
|
||||
|
||||
private fun processToe(
|
||||
foot: BoneState,
|
||||
toe: BoneState,
|
||||
side: Side,
|
||||
toeNumber: Int,
|
||||
splayDirection: Side,
|
||||
messages: MutableList<OscContent>,
|
||||
) {
|
||||
val oscToeNumber = toeNumber + 1
|
||||
val footRot = foot.rotation
|
||||
val toeRot = toe.rotation
|
||||
val currentRelative = footRot.inv() * toeRot
|
||||
|
||||
val euler = currentRelative.toEulerAngles(EulerOrder.XYZ)
|
||||
|
||||
val pitch = Math.toDegrees(euler.x.toDouble()).toFloat()
|
||||
val yaw = Math.toDegrees(euler.z.toDouble()).toFloat()
|
||||
val tipToe = pitch < MINIMUM_TIP_TOE_PITCH
|
||||
val bending = pitch > MINIMUM_BENDING_PITCH
|
||||
val splayed = when (splayDirection) {
|
||||
Side.LEFT -> yaw < -ABSOLUTE_SPLAY_THRESHOLD_ANGLE
|
||||
Side.RIGHT -> yaw > ABSOLUTE_SPLAY_THRESHOLD_ANGLE
|
||||
}
|
||||
val toeCurlValue = (pitch / MAXIMUM_ABSOLUTE_TOE_RANGE).coerceIn(-1f, 1f)
|
||||
val toeSplayValue = (yaw / MAXIMUM_ABSOLUTE_TOE_RANGE).coerceIn(-1f, 1f)
|
||||
messages.addAll(
|
||||
listOf(
|
||||
OscContent.Message(OscMessage("/avatar/parameters/TipToes${side.oscName}", listOf(if (tipToe) OscArg.True else OscArg.False))),
|
||||
OscContent.Message(OscMessage("/avatar/parameters/ToeBent${side.oscName}${oscToeNumber}Bool", listOf(if (bending) OscArg.True else OscArg.False))),
|
||||
OscContent.Message(OscMessage("/avatar/parameters/ToeSplay${side.oscName}$oscToeNumber", listOf(if (splayed) OscArg.True else OscArg.False))),
|
||||
OscContent.Message(OscMessage("/avatar/parameters/Toe${side.oscName}${oscToeNumber}Float", listOf(OscArg.Float(toeCurlValue)))),
|
||||
OscContent.Message(OscMessage("/avatar/parameters/ToeSplay${side.oscName}${oscToeNumber}Float", listOf(OscArg.Float(toeSplayValue)))),
|
||||
),
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,320 @@
|
||||
package dev.slimevr.skeleton
|
||||
|
||||
import dev.slimevr.skeleton.processors.ToeDirectLinkInputProcessor
|
||||
import io.github.axisangles.ktmath.Quaternion
|
||||
import org.junit.jupiter.api.Test
|
||||
import solarxr_protocol.datatypes.BodyPart
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class ToeDirectLinkProcessorTest {
|
||||
@Test
|
||||
fun `test missing all toe trackers`() {
|
||||
val processor = ToeDirectLinkInputProcessor()
|
||||
val inputs = DEFAULT_SKELETON_STATE.boneInputs.mutate { map ->
|
||||
map[BodyPart.LEFT_FOOT] = map.getValue(BodyPart.LEFT_FOOT).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(10f, 40f, 15f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.RIGHT_FOOT] = map.getValue(BodyPart.RIGHT_FOOT).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(20f, 50f, 25f),
|
||||
isActive = true,
|
||||
)
|
||||
}
|
||||
|
||||
val state = SkeletonState(
|
||||
boneInputs = inputs,
|
||||
skeletonHeight = 1.7f,
|
||||
paused = false,
|
||||
)
|
||||
|
||||
val newInputs = processor.process(state)
|
||||
|
||||
val leftBigToeIsSameRotationAsLeftFoot =
|
||||
newInputs.boneInputs[BodyPart.LEFT_BIG_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.LEFT_FOOT]?.rawRotation
|
||||
val leftIndexToeIsSameRotationAsLeftBigToe =
|
||||
newInputs.boneInputs[BodyPart.LEFT_INDEX_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.LEFT_BIG_TOE]?.rawRotation
|
||||
val leftMiddleToeIsSameRotationAsLeftIndexToe =
|
||||
newInputs.boneInputs[BodyPart.LEFT_MIDDLE_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.LEFT_INDEX_TOE]?.rawRotation
|
||||
val leftRingToeIsSameRotationAsLeftMiddleToe =
|
||||
newInputs.boneInputs[BodyPart.LEFT_RING_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.LEFT_MIDDLE_TOE]?.rawRotation
|
||||
val leftLittleToeIsSameRotationAsLeftRingToe =
|
||||
newInputs.boneInputs[BodyPart.LEFT_LITTLE_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.LEFT_RING_TOE]?.rawRotation
|
||||
|
||||
val rightBigToeIsSameRotationAsRightFoot =
|
||||
newInputs.boneInputs[BodyPart.RIGHT_BIG_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.RIGHT_FOOT]?.rawRotation
|
||||
val rightIndexToeIsSameRotationAsRightBigToe =
|
||||
newInputs.boneInputs[BodyPart.RIGHT_INDEX_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.RIGHT_BIG_TOE]?.rawRotation
|
||||
val rightMiddleToeIsSameRotationAsRightIndexToe =
|
||||
newInputs.boneInputs[BodyPart.RIGHT_MIDDLE_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.RIGHT_INDEX_TOE]?.rawRotation
|
||||
val rightRingToeIsSameRotationAsRightMiddleToe =
|
||||
newInputs.boneInputs[BodyPart.RIGHT_RING_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.RIGHT_MIDDLE_TOE]?.rawRotation
|
||||
val rightLittleToeIsSameRotationAsRightRingToe =
|
||||
newInputs.boneInputs[BodyPart.RIGHT_LITTLE_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.RIGHT_RING_TOE]?.rawRotation
|
||||
|
||||
assertTrue(
|
||||
leftBigToeIsSameRotationAsLeftFoot &&
|
||||
leftIndexToeIsSameRotationAsLeftBigToe &&
|
||||
leftMiddleToeIsSameRotationAsLeftIndexToe &&
|
||||
leftRingToeIsSameRotationAsLeftMiddleToe &&
|
||||
leftLittleToeIsSameRotationAsLeftRingToe,
|
||||
)
|
||||
assertTrue(
|
||||
rightBigToeIsSameRotationAsRightFoot &&
|
||||
rightIndexToeIsSameRotationAsRightBigToe &&
|
||||
rightMiddleToeIsSameRotationAsRightIndexToe &&
|
||||
rightRingToeIsSameRotationAsRightMiddleToe &&
|
||||
rightLittleToeIsSameRotationAsRightRingToe,
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test missing toe trackers from index toe downwards`() {
|
||||
val processor = ToeDirectLinkInputProcessor()
|
||||
val inputs = DEFAULT_SKELETON_STATE.boneInputs.mutate { map ->
|
||||
map[BodyPart.LEFT_FOOT] = map.getValue(BodyPart.LEFT_FOOT).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(10f, 40f, 15f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.LEFT_BIG_TOE] = map.getValue(BodyPart.LEFT_BIG_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(11f, 41f, 16f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.RIGHT_FOOT] = map.getValue(BodyPart.RIGHT_FOOT).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(20f, 50f, 25f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.RIGHT_BIG_TOE] = map.getValue(BodyPart.RIGHT_BIG_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(21f, 51f, 26f),
|
||||
isActive = true,
|
||||
)
|
||||
}
|
||||
|
||||
val state = SkeletonState(
|
||||
boneInputs = inputs,
|
||||
skeletonHeight = 1.7f,
|
||||
paused = false,
|
||||
)
|
||||
|
||||
val newInputs = processor.process(state)
|
||||
|
||||
val leftIndexToeIsSameRotationAsLeftBigToe =
|
||||
newInputs.boneInputs[BodyPart.LEFT_INDEX_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.LEFT_BIG_TOE]?.rawRotation
|
||||
val leftMiddleToeIsSameRotationAsLeftIndexToe =
|
||||
newInputs.boneInputs[BodyPart.LEFT_MIDDLE_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.LEFT_INDEX_TOE]?.rawRotation
|
||||
val leftRingToeIsSameRotationAsLeftMiddleToe =
|
||||
newInputs.boneInputs[BodyPart.LEFT_RING_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.LEFT_MIDDLE_TOE]?.rawRotation
|
||||
val leftLittleToeIsSameRotationAsLeftRingToe =
|
||||
newInputs.boneInputs[BodyPart.LEFT_LITTLE_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.LEFT_RING_TOE]?.rawRotation
|
||||
|
||||
val rightIndexToeIsSameRotationAsRightBigToe =
|
||||
newInputs.boneInputs[BodyPart.RIGHT_INDEX_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.RIGHT_BIG_TOE]?.rawRotation
|
||||
val rightMiddleToeIsSameRotationAsRightIndexToe =
|
||||
newInputs.boneInputs[BodyPart.RIGHT_MIDDLE_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.RIGHT_INDEX_TOE]?.rawRotation
|
||||
val rightRingToeIsSameRotationAsRightMiddleToe =
|
||||
newInputs.boneInputs[BodyPart.RIGHT_RING_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.RIGHT_MIDDLE_TOE]?.rawRotation
|
||||
val rightLittleToeIsSameRotationAsRightRingToe =
|
||||
newInputs.boneInputs[BodyPart.RIGHT_LITTLE_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.RIGHT_RING_TOE]?.rawRotation
|
||||
|
||||
assertTrue(
|
||||
leftIndexToeIsSameRotationAsLeftBigToe &&
|
||||
leftMiddleToeIsSameRotationAsLeftIndexToe &&
|
||||
leftRingToeIsSameRotationAsLeftMiddleToe &&
|
||||
leftLittleToeIsSameRotationAsLeftRingToe,
|
||||
)
|
||||
assertTrue(
|
||||
rightIndexToeIsSameRotationAsRightBigToe &&
|
||||
rightMiddleToeIsSameRotationAsRightIndexToe &&
|
||||
rightRingToeIsSameRotationAsRightMiddleToe &&
|
||||
rightLittleToeIsSameRotationAsRightRingToe,
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test missing toe trackers from middle toe downwards`() {
|
||||
val processor = ToeDirectLinkInputProcessor()
|
||||
val inputs = DEFAULT_SKELETON_STATE.boneInputs.mutate { map ->
|
||||
map[BodyPart.LEFT_FOOT] = map.getValue(BodyPart.LEFT_FOOT).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(10f, 40f, 15f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.LEFT_BIG_TOE] = map.getValue(BodyPart.LEFT_BIG_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(11f, 41f, 16f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.LEFT_INDEX_TOE] = map.getValue(BodyPart.LEFT_INDEX_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(12f, 42f, 17f),
|
||||
isActive = true,
|
||||
)
|
||||
|
||||
map[BodyPart.RIGHT_FOOT] = map.getValue(BodyPart.RIGHT_FOOT).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(20f, 50f, 25f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.RIGHT_BIG_TOE] = map.getValue(BodyPart.RIGHT_BIG_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(21f, 51f, 26f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.RIGHT_INDEX_TOE] = map.getValue(BodyPart.RIGHT_INDEX_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(22f, 52f, 27f),
|
||||
isActive = true,
|
||||
)
|
||||
}
|
||||
|
||||
val state = SkeletonState(
|
||||
boneInputs = inputs,
|
||||
skeletonHeight = 1.7f,
|
||||
paused = false,
|
||||
)
|
||||
|
||||
val newInputs = processor.process(state)
|
||||
|
||||
val leftMiddleToeIsSameRotationAsLeftIndexToe =
|
||||
newInputs.boneInputs[BodyPart.LEFT_MIDDLE_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.LEFT_INDEX_TOE]?.rawRotation
|
||||
val leftRingToeIsSameRotationAsLeftMiddleToe =
|
||||
newInputs.boneInputs[BodyPart.LEFT_RING_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.LEFT_MIDDLE_TOE]?.rawRotation
|
||||
val leftLittleToeIsSameRotationAsLeftRingToe =
|
||||
newInputs.boneInputs[BodyPart.LEFT_LITTLE_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.LEFT_RING_TOE]?.rawRotation
|
||||
|
||||
val rightMiddleToeIsSameRotationAsRightIndexToe =
|
||||
newInputs.boneInputs[BodyPart.RIGHT_MIDDLE_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.RIGHT_INDEX_TOE]?.rawRotation
|
||||
val rightRingToeIsSameRotationAsRightMiddleToe =
|
||||
newInputs.boneInputs[BodyPart.RIGHT_RING_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.RIGHT_MIDDLE_TOE]?.rawRotation
|
||||
val rightLittleToeIsSameRotationAsRightRingToe =
|
||||
newInputs.boneInputs[BodyPart.RIGHT_LITTLE_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.RIGHT_RING_TOE]?.rawRotation
|
||||
|
||||
assertTrue(
|
||||
leftMiddleToeIsSameRotationAsLeftIndexToe &&
|
||||
leftRingToeIsSameRotationAsLeftMiddleToe &&
|
||||
leftLittleToeIsSameRotationAsLeftRingToe,
|
||||
)
|
||||
assertTrue(
|
||||
rightMiddleToeIsSameRotationAsRightIndexToe &&
|
||||
rightRingToeIsSameRotationAsRightMiddleToe &&
|
||||
rightLittleToeIsSameRotationAsRightRingToe,
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test missing toe trackers from ring toe downwards`() {
|
||||
val processor = ToeDirectLinkInputProcessor()
|
||||
val inputs = DEFAULT_SKELETON_STATE.boneInputs.mutate { map ->
|
||||
map[BodyPart.LEFT_FOOT] = map.getValue(BodyPart.LEFT_FOOT).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(10f, 40f, 15f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.LEFT_BIG_TOE] = map.getValue(BodyPart.LEFT_BIG_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(11f, 41f, 16f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.LEFT_INDEX_TOE] = map.getValue(BodyPart.LEFT_INDEX_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(12f, 42f, 17f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.LEFT_MIDDLE_TOE] = map.getValue(BodyPart.LEFT_MIDDLE_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(13f, 43f, 18f),
|
||||
isActive = true,
|
||||
)
|
||||
|
||||
map[BodyPart.RIGHT_FOOT] = map.getValue(BodyPart.RIGHT_FOOT).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(20f, 50f, 25f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.RIGHT_BIG_TOE] = map.getValue(BodyPart.RIGHT_BIG_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(21f, 51f, 26f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.RIGHT_INDEX_TOE] = map.getValue(BodyPart.RIGHT_INDEX_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(22f, 52f, 27f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.RIGHT_MIDDLE_TOE] = map.getValue(BodyPart.RIGHT_MIDDLE_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(23f, 53f, 28f),
|
||||
isActive = true,
|
||||
)
|
||||
}
|
||||
|
||||
val state = SkeletonState(
|
||||
boneInputs = inputs,
|
||||
skeletonHeight = 1.7f,
|
||||
paused = false,
|
||||
)
|
||||
|
||||
val newInputs = processor.process(state)
|
||||
|
||||
val leftRingToeIsSameRotationAsLeftMiddleToe =
|
||||
newInputs.boneInputs[BodyPart.LEFT_RING_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.LEFT_MIDDLE_TOE]?.rawRotation
|
||||
val leftLittleToeIsSameRotationAsLeftRingToe =
|
||||
newInputs.boneInputs[BodyPart.LEFT_LITTLE_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.LEFT_RING_TOE]?.rawRotation
|
||||
|
||||
val rightRingToeIsSameRotationAsRightMiddleToe =
|
||||
newInputs.boneInputs[BodyPart.RIGHT_RING_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.RIGHT_MIDDLE_TOE]?.rawRotation
|
||||
val rightLittleToeIsSameRotationAsRightRingToe =
|
||||
newInputs.boneInputs[BodyPart.RIGHT_LITTLE_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.RIGHT_RING_TOE]?.rawRotation
|
||||
|
||||
assertTrue(leftRingToeIsSameRotationAsLeftMiddleToe && leftLittleToeIsSameRotationAsLeftRingToe)
|
||||
assertTrue(rightRingToeIsSameRotationAsRightMiddleToe && rightLittleToeIsSameRotationAsRightRingToe)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test missing little toe tracker`() {
|
||||
val processor = ToeDirectLinkInputProcessor()
|
||||
val inputs = DEFAULT_SKELETON_STATE.boneInputs.mutate { map ->
|
||||
map[BodyPart.LEFT_FOOT] = map.getValue(BodyPart.LEFT_FOOT).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(10f, 40f, 15f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.LEFT_BIG_TOE] = map.getValue(BodyPart.LEFT_BIG_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(11f, 41f, 16f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.LEFT_INDEX_TOE] = map.getValue(BodyPart.LEFT_INDEX_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(12f, 42f, 17f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.LEFT_MIDDLE_TOE] = map.getValue(BodyPart.LEFT_MIDDLE_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(15f, 45f, 19f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.LEFT_RING_TOE] = map.getValue(BodyPart.LEFT_RING_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(13f, 43f, 18f),
|
||||
isActive = true,
|
||||
)
|
||||
|
||||
map[BodyPart.RIGHT_FOOT] = map.getValue(BodyPart.RIGHT_FOOT).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(20f, 50f, 25f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.RIGHT_BIG_TOE] = map.getValue(BodyPart.RIGHT_BIG_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(21f, 51f, 26f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.RIGHT_INDEX_TOE] = map.getValue(BodyPart.RIGHT_INDEX_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(22f, 52f, 27f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.RIGHT_MIDDLE_TOE] = map.getValue(BodyPart.RIGHT_MIDDLE_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(23f, 53f, 28f),
|
||||
isActive = true,
|
||||
)
|
||||
map[BodyPart.RIGHT_RING_TOE] = map.getValue(BodyPart.RIGHT_RING_TOE).copy(
|
||||
rawRotation = Quaternion.Companion.fromRotationVector(24f, 54f, 29f),
|
||||
isActive = true,
|
||||
)
|
||||
}
|
||||
|
||||
val state = SkeletonState(
|
||||
boneInputs = inputs,
|
||||
skeletonHeight = 1.7f,
|
||||
paused = false,
|
||||
)
|
||||
|
||||
val newInputs = processor.process(state)
|
||||
|
||||
val leftLittleToeIsSameRotationAsLeftRingToe =
|
||||
newInputs.boneInputs[BodyPart.LEFT_LITTLE_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.LEFT_RING_TOE]?.rawRotation
|
||||
val rightLittleToeIsSameRotationAsRightRingToe =
|
||||
newInputs.boneInputs[BodyPart.RIGHT_LITTLE_TOE]?.rawRotation == newInputs.boneInputs[BodyPart.RIGHT_RING_TOE]?.rawRotation
|
||||
|
||||
assertTrue(leftLittleToeIsSameRotationAsLeftRingToe && rightLittleToeIsSameRotationAsRightRingToe)
|
||||
}
|
||||
}
|
||||
+1
-1
Submodule solarxr-protocol updated: 0e107b6b9f...f1bf9d386f.
Reference in new issue
Block a user