diff --git a/gui/app/public/i18n/en/translation.ftl b/gui/app/public/i18n/en/translation.ftl index dcdc21b38..9aacfe67e 100644 --- a/gui/app/public/i18n/en/translation.ftl +++ b/gui/app/public/i18n/en/translation.ftl @@ -71,8 +71,9 @@ body_part-RIGHT_UPPER_LEG = Right thigh body_part-RIGHT_LOWER_LEG = Right ankle body_part-RIGHT_FOOT = Right foot body_part-UPPER_CHEST = Upper chest -body_part-CHEST = Chest -body_part-WAIST = Waist +body_part-LOWER_CHEST = Lower chest +body_part-UPPER_WAIST = Upper waist +body_part-LOWER_WAIST = Lower waist body_part-HIP = Hip body_part-LEFT_SHOULDER = Left shoulder body_part-LEFT_UPPER_ARM = Left upper arm @@ -173,19 +174,24 @@ skeleton_bone-UPPER_CHEST-desc = This is the distance from the base of your neck to the middle of your chest. To adjust it, adjust your Torso Length properly and modify it in various positions (sitting down, bending over, lying down, etc.) until your virtual spine matches with your real one. -skeleton_bone-CHEST = Chest Length -skeleton_bone-CHEST-desc = +skeleton_bone-LOWER_CHEST = Lower Chest Length +skeleton_bone-LOWER_CHEST-desc = This is the distance from the middle of your chest to the middle of your spine. To adjust it, adjust your Torso Length properly and modify it in various positions (sitting down, bending over, lying down, etc.) until your virtual spine matches with your real one. -skeleton_bone-WAIST = Waist Length -skeleton_bone-WAIST-desc = - This is the distance from the middle of your spine to your belly button. +skeleton_bone-UPPER_WAIST = Upper Waist Length +skeleton_bone-UPPER_WAIST-desc = + This is the distance from the middle of your spine to a bit above your belly button. + To adjust it, adjust your Torso Length properly and modify it in various positions + (sitting down, bending over, lying down, etc.) until your virtual spine matches with your real one. +skeleton_bone-LOWER_WAIST = Lower Waist Length +skeleton_bone-LOWER_WAIST-desc = + This is the distance from a bit above your belly button to a bit below it. To adjust it, adjust your Torso Length properly and modify it in various positions (sitting down, bending over, lying down, etc.) until your virtual spine matches with your real one. skeleton_bone-HIP = Hip Length skeleton_bone-HIP-desc = - This is the distance from your belly button to your hips. + This is the distance from a bit bellow your belly button to your hips. To adjust it, set your Torso Length properly and modify it in various positions (sitting down, bending over, lying down, etc.) until your virtual spine matches your real one. skeleton_bone-HIPS_WIDTH = Hips Width @@ -692,7 +698,7 @@ settings-general-fk_settings-arm_fk-forward-description = Expects your arms to b settings-general-fk_settings-skeleton_settings-ratios = Skeleton ratios settings-general-fk_settings-skeleton_settings-ratios-description = Change the values of skeleton settings. You may need to adjust your proportions after changing these. settings-general-fk_settings-skeleton_settings-impute_spine_from_upper_to_lower = Estimate missing spine trackers from upper to lower -settings-general-fk_settings-skeleton_settings-impute_spine_curvature = Spine curvature of adjacent missing spine trackers +settings-general-fk_settings-skeleton_settings-impute_spine_curvature = Spine curvature settings-general-fk_settings-skeleton_settings-interpolate_hip_with_upper_legs = Interpolate the hip with the upper legs settings-general-fk_settings-skeleton_settings-interpolate_upper_legs_twist_with_lower_legs = Interpolate the upper legs' twists with the lower legs' settings-general-fk_settings-self_localization-title = Mocap mode diff --git a/gui/app/src/components/commons/BodyPartIcon.tsx b/gui/app/src/components/commons/BodyPartIcon.tsx index ff86eaef8..e1e3e1ca9 100644 --- a/gui/app/src/components/commons/BodyPartIcon.tsx +++ b/gui/app/src/components/commons/BodyPartIcon.tsx @@ -72,7 +72,7 @@ export const mapPart: Record< }) => JSX.Element > = { [BodyPart.UPPER_CHEST]: ({ width }) => , - [BodyPart.CHEST]: ({ width }) => , + [BodyPart.LOWER_CHEST]: ({ width }) => , [BodyPart.HEAD]: ({ width }) => , [BodyPart.HIP]: ({ width }) => , [BodyPart.LEFT_FOOT]: ({ width, currentLocales }) => @@ -111,7 +111,8 @@ export const mapPart: Record< [BodyPart.RIGHT_UPPER_LEG]: ({ width }) => ( ), - [BodyPart.WAIST]: ({ width }) => , + [BodyPart.UPPER_WAIST]: ({ width }) => , + [BodyPart.LOWER_WAIST]: ({ width }) => , [BodyPart.LEFT_THUMB_METACARPAL]: ({ width }) => ( ), diff --git a/gui/app/src/components/commons/PersonFrontIcon.tsx b/gui/app/src/components/commons/PersonFrontIcon.tsx index 1b114ab8f..f82583b83 100644 --- a/gui/app/src/components/commons/PersonFrontIcon.tsx +++ b/gui/app/src/components/commons/PersonFrontIcon.tsx @@ -53,16 +53,16 @@ export function PersonFrontIcon({ + [ ]; const RIGHT_GROUPS = (side: BodySide): BodyPart[][] => [ - [BodyPart.UPPER_CHEST, BodyPart.CHEST], + [BodyPart.UPPER_CHEST, BodyPart.LOWER_CHEST], [side.shoulder, side.upperArm], [side.lowerArm, side.hand], - [BodyPart.WAIST], + [BodyPart.UPPER_WAIST, BodyPart.LOWER_WAIST], [side.upperLeg, side.lowerLeg, side.foot], ]; diff --git a/gui/app/src/components/settings/pages/components/TapDetectionSettings.tsx b/gui/app/src/components/settings/pages/components/TapDetectionSettings.tsx index 93a092e6e..14fb35055 100644 --- a/gui/app/src/components/settings/pages/components/TapDetectionSettings.tsx +++ b/gui/app/src/components/settings/pages/components/TapDetectionSettings.tsx @@ -45,7 +45,7 @@ const defaultValues: TapDetectionForm = { yawResetTaps: 2, fullResetTaps: 2, mountingResetTaps: 2, - yawResetTracker: String(BodyPart.CHEST), + yawResetTracker: String(BodyPart.UPPER_CHEST), fullResetTracker: String(BodyPart.LEFT_UPPER_LEG), mountingResetTracker: String(BodyPart.RIGHT_UPPER_LEG), numberTrackersOverThreshold: 1, diff --git a/gui/app/src/components/widgets/SkeletonVisualizerWidget.tsx b/gui/app/src/components/widgets/SkeletonVisualizerWidget.tsx index 5279ba8eb..a018a1da1 100644 --- a/gui/app/src/components/widgets/SkeletonVisualizerWidget.tsx +++ b/gui/app/src/components/widgets/SkeletonVisualizerWidget.tsx @@ -201,7 +201,7 @@ function initializePreview( const root = bones.get(BodyPart.HEAD) ?? bones.get(BodyPart.HIP) ?? - bones.get(BodyPart.WAIST); + bones.get(BodyPart.LOWER_WAIST); if (!root) return out.copy(followOffset); out.copy(Vector3FromVec3fT(root.headPosition)); skeletonGroup.updateWorldMatrix(true, false); diff --git a/gui/app/src/hooks/body-parts.ts b/gui/app/src/hooks/body-parts.ts index 93add9328..1c56caa24 100644 --- a/gui/app/src/hooks/body-parts.ts +++ b/gui/app/src/hooks/body-parts.ts @@ -4,8 +4,9 @@ export const SPINE_BODY_PARTS = [ BodyPart.HEAD, BodyPart.NECK, BodyPart.UPPER_CHEST, - BodyPart.CHEST, - BodyPart.WAIST, + BodyPart.LOWER_CHEST, + BodyPart.UPPER_WAIST, + BodyPart.LOWER_WAIST, BodyPart.HIP, ]; export const LEG_BODY_PARTS = [ diff --git a/gui/app/src/hooks/manual-proportions.ts b/gui/app/src/hooks/manual-proportions.ts index e83be0d63..4e4e9e9e6 100644 --- a/gui/app/src/hooks/manual-proportions.ts +++ b/gui/app/src/hooks/manual-proportions.ts @@ -38,9 +38,10 @@ const BONE_MAPPING: Map = new Map([ 'skeleton_bone-torso_group', [ SkeletonBone.UPPER_CHEST, - SkeletonBone.CHEST, + SkeletonBone.LOWER_CHEST, SkeletonBone.HIP, - SkeletonBone.WAIST, + SkeletonBone.UPPER_WAIST, + SkeletonBone.LOWER_WAIST, ], ], ['skeleton_bone-leg_group', [SkeletonBone.UPPER_LEG, SkeletonBone.LOWER_LEG]], diff --git a/gui/app/src/hooks/tracker-picker.ts b/gui/app/src/hooks/tracker-picker.ts index 7c1b2f4a3..5c427f1ca 100644 --- a/gui/app/src/hooks/tracker-picker.ts +++ b/gui/app/src/hooks/tracker-picker.ts @@ -39,8 +39,9 @@ export const LOWER_BODY = new Set([ ]); export const SPINE_PARTS = [ BodyPart.UPPER_CHEST, - BodyPart.CHEST, - BodyPart.WAIST, + BodyPart.LOWER_CHEST, + BodyPart.UPPER_WAIST, + BodyPart.LOWER_WAIST, BodyPart.HIP, ]; export const ASSIGNMENT_RULES: Partial> = { @@ -54,8 +55,9 @@ export const ASSIGNMENT_RULES: Partial { const parts = new Set(); - addParts(parts, [BodyPart.CHEST, ...LEGS_PARTS]); + addParts(parts, [BodyPart.UPPER_CHEST, ...LEGS_PARTS]); if (connectedIMUTrackersCount >= 6) parts.add(BodyPart.HIP); - if (connectedIMUTrackersCount === 7) parts.add(BodyPart.WAIST); + if (connectedIMUTrackersCount === 7) parts.add(BodyPart.LOWER_WAIST); if (connectedIMUTrackersCount >= 8) { addParts(parts, [BodyPart.LEFT_FOOT, BodyPart.RIGHT_FOOT]); } - if (connectedIMUTrackersCount >= 9) parts.add(BodyPart.WAIST); + if (connectedIMUTrackersCount >= 9) parts.add(BodyPart.LOWER_WAIST); if (connectedIMUTrackersCount >= 10) { addParts(parts, [BodyPart.LEFT_UPPER_ARM, BodyPart.RIGHT_UPPER_ARM]); } @@ -214,7 +216,9 @@ export function providePicker() { // Special exception for waist/hip: https://github.com/SlimeVR/SlimeVR-Server/issues/612 if ( - (assignedRole === BodyPart.HIP || assignedRole === BodyPart.WAIST) && + (assignedRole === BodyPart.HIP || + assignedRole === BodyPart.LOWER_WAIST || + assignedRole === BodyPart.UPPER_WAIST) && !trackerRoles.some((t) => LOWER_BODY.has(t)) ) { return; diff --git a/gui/app/src/utils/skeletonHelper.ts b/gui/app/src/utils/skeletonHelper.ts index bf4d6e586..2477b688a 100644 --- a/gui/app/src/utils/skeletonHelper.ts +++ b/gui/app/src/utils/skeletonHelper.ts @@ -28,8 +28,9 @@ const BONE_COLOR_GROUPS: [BodyPart[], string][] = [ [BodyPart.UPPER_CHEST, BodyPart.LEFT_UPPER_LEG, BodyPart.RIGHT_UPPER_LEG], 'chartreuse', ], - [[BodyPart.CHEST], 'purple'], - [[BodyPart.WAIST, BodyPart.LEFT_LOWER_ARM, BodyPart.RIGHT_LOWER_ARM], 'red'], + [[BodyPart.LOWER_CHEST], 'purple'], + [[BodyPart.UPPER_WAIST], 'pink'], + [[BodyPart.LOWER_WAIST, BodyPart.LEFT_LOWER_ARM, BodyPart.RIGHT_LOWER_ARM], 'red'], [[BodyPart.HIP], 'orange'], [[BodyPart.LEFT_LOWER_LEG, BodyPart.RIGHT_LOWER_LEG], 'teal'], [[BodyPart.LEFT_UPPER_ARM, BodyPart.RIGHT_UPPER_ARM], 'indianred'], diff --git a/gui/app/src/utils/skeletonParts.ts b/gui/app/src/utils/skeletonParts.ts index 09890656f..c72470588 100644 --- a/gui/app/src/utils/skeletonParts.ts +++ b/gui/app/src/utils/skeletonParts.ts @@ -257,16 +257,28 @@ export const SKELETON_PART_PRESETS: Record = { offset: inBoneLengths({ length: -0.2 }), }) ), - [BodyPart.CHEST]: part( + [BodyPart.LOWER_CHEST]: part( model('chest', { - scale: spanBone({ girthFrom: 'shoulders', length: 1, width: 0.95, depth: 0.95 }), + scale: spanBone({ + girthFrom: 'shoulders', + length: 0.95, + width: 0.95, + depth: 0.95, + }), offset: inBoneLengths({ length: 0 }), }), { trackerOffset: CHEST_TRACKER_OFFSET } ), - [BodyPart.WAIST]: part( + [BodyPart.UPPER_WAIST]: part( model('waist', { - scale: spanBone({ girthFrom: 'hips', length: 1.1, width: 0.95, depth: 0.95 }), + scale: spanBone({ girthFrom: 'hips', length: 0.95, width: 0.95, depth: 0.95 }), + offset: inBoneLengths({ length: 0.1 }), + }), + { trackerOffset: WAIST_TRACKER_OFFSET } + ), + [BodyPart.LOWER_WAIST]: part( + model('waist', { + scale: spanBone({ girthFrom: 'hips', length: 1, width: 0.95, depth: 0.95 }), offset: inBoneLengths({ length: -0.05 }), }), { trackerOffset: WAIST_TRACKER_OFFSET } diff --git a/gui/app/src/utils/skeletonProportions.ts b/gui/app/src/utils/skeletonProportions.ts index 2790718b1..a9e29c1e6 100644 --- a/gui/app/src/utils/skeletonProportions.ts +++ b/gui/app/src/utils/skeletonProportions.ts @@ -7,8 +7,9 @@ import { EYE_HEIGHT_TO_HEIGHT_RATIO } from '@/hooks/height'; export const Y_PARTS = [ BodyPart.NECK, BodyPart.UPPER_CHEST, - BodyPart.CHEST, - BodyPart.WAIST, + BodyPart.LOWER_CHEST, + BodyPart.UPPER_WAIST, + BodyPart.LOWER_WAIST, BodyPart.HIP, BodyPart.LEFT_UPPER_LEG, BodyPart.LEFT_LOWER_LEG, diff --git a/server/core/src/main/java/dev/slimevr/autobone/functions.kt b/server/core/src/main/java/dev/slimevr/autobone/functions.kt index 73f5cebfa..8c5177808 100644 --- a/server/core/src/main/java/dev/slimevr/autobone/functions.kt +++ b/server/core/src/main/java/dev/slimevr/autobone/functions.kt @@ -19,8 +19,9 @@ fun slideContributionWeight(ankleA: Vector3, ankleB: Vector3, localBoneTailA: Ve // TODO This is a placeholder val PLACEHOLDER_BODY_PARTS_TO_ADJUST = arrayOf( BodyPart.UPPER_CHEST, - BodyPart.CHEST, - BodyPart.WAIST, + BodyPart.LOWER_CHEST, + BodyPart.UPPER_WAIST, + BodyPart.LOWER_WAIST, BodyPart.HIP, // etc. ) diff --git a/server/core/src/main/java/dev/slimevr/config/settings.kt b/server/core/src/main/java/dev/slimevr/config/settings.kt index 219651a2e..f10b5ad3b 100644 --- a/server/core/src/main/java/dev/slimevr/config/settings.kt +++ b/server/core/src/main/java/dev/slimevr/config/settings.kt @@ -2,7 +2,7 @@ package dev.slimevr.config import dev.slimevr.context.Behaviour import dev.slimevr.context.Context -import dev.slimevr.skeleton.inputprocessors.DEFAULT_SPINE_RATIO +import dev.slimevr.skeleton.inputprocessors.DEFAULT_SPINE_UPPER_LOWER import io.github.axisangles.ktmath.Quaternion import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Job @@ -77,7 +77,7 @@ data class TapDetectionConfig( var fullResetEnabled: Boolean = true, var mountingResetEnabled: Boolean = true, @Serializable(with = BodyPartSerializer::class) - var yawResetBodyPart: BodyPart? = BodyPart.CHEST, + var yawResetBodyPart: BodyPart? = BodyPart.UPPER_CHEST, @Serializable(with = BodyPartSerializer::class) var mountingResetBodyPart: BodyPart? = BodyPart.RIGHT_UPPER_LEG, @Serializable(with = BodyPartSerializer::class) @@ -138,8 +138,8 @@ data class SkeletonTogglesConfig( // Used in SkeletonConfig @Serializable data class SkeletonRatiosConfig( - val imputeSpineFromUpperToLower: Float = DEFAULT_SPINE_RATIO, - val imputeSpineCurvature: Float = DEFAULT_SPINE_RATIO, + val imputeSpineFromUpperToLower: Float = DEFAULT_SPINE_UPPER_LOWER, + val imputeSpineCurvature: Float = 0.8f, val interpolateHipWithUpperLegs: Float = 0.25f, val interpolateUpperLegsTwistWithLowerLegs: Float = 0.85f, val skatingCorrectionStrength: Float = 0.3f, @@ -148,8 +148,8 @@ data class SkeletonRatiosConfig( // Used in SkeletonConfig @Serializable data class SkeletonFilteringConfig( - val type: FilteringType = FilteringType.NONE, - val amount: Float = 0.2f, + val type: FilteringType = FilteringType.SMOOTHING, + val amount: Float = 0.1f, ) @Serializable diff --git a/server/core/src/main/java/dev/slimevr/routing/routing.kt b/server/core/src/main/java/dev/slimevr/routing/routing.kt index 2540acb49..53fbf216b 100644 --- a/server/core/src/main/java/dev/slimevr/routing/routing.kt +++ b/server/core/src/main/java/dev/slimevr/routing/routing.kt @@ -15,7 +15,6 @@ import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.map import solarxr_protocol.datatypes.BodyPart import solarxr_protocol.datatypes.DeviceOrigin -import solarxr_protocol.datatypes.TrackerStatus import solarxr_protocol.rpc.RoutingOutput import solarxr_protocol.rpc.RoutingOutputState import solarxr_protocol.rpc.VRCOSCOutputState @@ -159,10 +158,10 @@ fun applyRoutingChange( } private val candidateToFineBodyParts = mapOf( - BodyPart.UPPER_CHEST to setOf(BodyPart.UPPER_CHEST, BodyPart.CHEST), + BodyPart.UPPER_CHEST to setOf(BodyPart.UPPER_CHEST, BodyPart.LOWER_CHEST), BodyPart.LEFT_UPPER_ARM to setOf(BodyPart.LEFT_UPPER_ARM, BodyPart.LEFT_LOWER_ARM), BodyPart.RIGHT_UPPER_ARM to setOf(BodyPart.RIGHT_UPPER_ARM, BodyPart.RIGHT_LOWER_ARM), - BodyPart.HIP to setOf(BodyPart.HIP, BodyPart.WAIST, BodyPart.CHEST, BodyPart.UPPER_CHEST), + BodyPart.HIP to setOf(BodyPart.HIP, BodyPart.LOWER_WAIST, BodyPart.UPPER_WAIST, BodyPart.LOWER_CHEST, BodyPart.UPPER_CHEST), BodyPart.LEFT_UPPER_LEG to setOf(BodyPart.LEFT_UPPER_LEG), BodyPart.RIGHT_UPPER_LEG to setOf(BodyPart.RIGHT_UPPER_LEG), BodyPart.LEFT_FOOT to setOf(BodyPart.LEFT_FOOT, BodyPart.LEFT_LOWER_LEG, BodyPart.LEFT_UPPER_LEG), diff --git a/server/core/src/main/java/dev/slimevr/skeleton/behaviours.kt b/server/core/src/main/java/dev/slimevr/skeleton/behaviours.kt index ac63d5354..e5e329569 100644 --- a/server/core/src/main/java/dev/slimevr/skeleton/behaviours.kt +++ b/server/core/src/main/java/dev/slimevr/skeleton/behaviours.kt @@ -78,7 +78,7 @@ class YouSpinMeRightRoundBehaviour(val inputHz: Float = 1f) : SkeletonBehaviour receiver.context.dispatch( SkeletonActions.SetBoneRotation( - BodyPart.CHEST, + BodyPart.LOWER_CHEST, Quaternion.fromRotationVector(Vector3(cos(elapsed), sin(elapsed), 0f)), ), ) diff --git a/server/core/src/main/java/dev/slimevr/skeleton/bodypart-constraints.kt b/server/core/src/main/java/dev/slimevr/skeleton/bodypart-constraints.kt index 1e9fe457e..d0fa8499a 100644 --- a/server/core/src/main/java/dev/slimevr/skeleton/bodypart-constraints.kt +++ b/server/core/src/main/java/dev/slimevr/skeleton/bodypart-constraints.kt @@ -48,11 +48,15 @@ val BODY_PART_CONSTRAINT_MAP: BodyPartMap = BodyPartMap( 90f * FastMath.DEG_TO_RAD, 120f * FastMath.DEG_TO_RAD, ), - BodyPart.CHEST to TwistSwingConstraint( + BodyPart.LOWER_CHEST to TwistSwingConstraint( 60f * FastMath.DEG_TO_RAD, 120f * FastMath.DEG_TO_RAD, ), - BodyPart.WAIST to TwistSwingConstraint( + BodyPart.UPPER_WAIST to TwistSwingConstraint( + 60f * FastMath.DEG_TO_RAD, + 120f * FastMath.DEG_TO_RAD, + ), + BodyPart.LOWER_WAIST to TwistSwingConstraint( 60f * FastMath.DEG_TO_RAD, 120f * FastMath.DEG_TO_RAD, ), diff --git a/server/core/src/main/java/dev/slimevr/skeleton/bodypart-ik-chains.kt b/server/core/src/main/java/dev/slimevr/skeleton/bodypart-ik-chains.kt index 252e4ebba..04e98fe15 100644 --- a/server/core/src/main/java/dev/slimevr/skeleton/bodypart-ik-chains.kt +++ b/server/core/src/main/java/dev/slimevr/skeleton/bodypart-ik-chains.kt @@ -23,8 +23,9 @@ val BODY_PART_IK_CHAIN_MAP: BodyPartMap = BodyPartMap( ), BodyPart.HIP to listOf( BodyPart.UPPER_CHEST, - BodyPart.CHEST, - BodyPart.WAIST, + BodyPart.LOWER_CHEST, + BodyPart.UPPER_WAIST, + BodyPart.LOWER_WAIST, BodyPart.HIP, ), BodyPart.LEFT_LOWER_LEG to listOf( diff --git a/server/core/src/main/java/dev/slimevr/skeleton/bodypart-structure.kt b/server/core/src/main/java/dev/slimevr/skeleton/bodypart-structure.kt index c812fec5d..c6191d243 100644 --- a/server/core/src/main/java/dev/slimevr/skeleton/bodypart-structure.kt +++ b/server/core/src/main/java/dev/slimevr/skeleton/bodypart-structure.kt @@ -51,9 +51,10 @@ val BODY_PART_HIERARCHY_MAP: BodyPartMap> = BodyPartMap( BodyPart.RIGHT_LITTLE_PROXIMAL to arrayOf(BodyPart.RIGHT_LITTLE_INTERMEDIATE), BodyPart.RIGHT_LITTLE_INTERMEDIATE to arrayOf(BodyPart.RIGHT_LITTLE_DISTAL), - BodyPart.UPPER_CHEST to arrayOf(BodyPart.CHEST), - BodyPart.CHEST to arrayOf(BodyPart.WAIST), - BodyPart.WAIST to arrayOf(BodyPart.HIP), + BodyPart.UPPER_CHEST to arrayOf(BodyPart.LOWER_CHEST), + BodyPart.LOWER_CHEST to arrayOf(BodyPart.UPPER_WAIST), + BodyPart.UPPER_WAIST to arrayOf(BodyPart.LOWER_WAIST), + BodyPart.LOWER_WAIST to arrayOf(BodyPart.HIP), BodyPart.HIP to arrayOf(BodyPart.LEFT_UPPER_LEG, BodyPart.RIGHT_UPPER_LEG), BodyPart.LEFT_UPPER_LEG to arrayOf(BodyPart.LEFT_LOWER_LEG), diff --git a/server/core/src/main/java/dev/slimevr/skeleton/centre-of-mass.kt b/server/core/src/main/java/dev/slimevr/skeleton/centre-of-mass.kt index 4874a5156..ab135dfa5 100644 --- a/server/core/src/main/java/dev/slimevr/skeleton/centre-of-mass.kt +++ b/server/core/src/main/java/dev/slimevr/skeleton/centre-of-mass.kt @@ -12,8 +12,10 @@ val BODY_PART_MASSES = mapOf( BodyPart.RIGHT_UPPER_ARM to 0.0263f, BodyPart.LEFT_LOWER_ARM to 0.0224f, BodyPart.RIGHT_LOWER_ARM to 0.0224f, - BodyPart.CHEST to 0.1870f, - BodyPart.WAIST to 0.1320f, + BodyPart.UPPER_CHEST to 0.0935f, + BodyPart.LOWER_CHEST to 0.0935f, + BodyPart.UPPER_WAIST to 0.0660f, + BodyPart.LOWER_WAIST to 0.0660f, BodyPart.HIP to 0.1530f, BodyPart.LEFT_UPPER_LEG to 0.1122f, BodyPart.RIGHT_UPPER_LEG to 0.1122f, diff --git a/server/core/src/main/java/dev/slimevr/skeleton/fkprocessors/localizer.kt b/server/core/src/main/java/dev/slimevr/skeleton/fkprocessors/localizer.kt index a0c7a4c2c..9e4bd3282 100644 --- a/server/core/src/main/java/dev/slimevr/skeleton/fkprocessors/localizer.kt +++ b/server/core/src/main/java/dev/slimevr/skeleton/fkprocessors/localizer.kt @@ -155,7 +155,7 @@ object HipLocalizer { } object COMLocalizer { - private val TORSO_TRACKERS = setOf(BodyPart.UPPER_CHEST, BodyPart.CHEST, BodyPart.WAIST, BodyPart.HIP) + private val TORSO_TRACKERS = setOf(BodyPart.UPPER_CHEST, BodyPart.LOWER_CHEST, BodyPart.UPPER_WAIST, BodyPart.LOWER_WAIST, BodyPart.HIP) /** Get the average accel of the torso bones */ fun getTorsoAccel(inputs: InputSkeleton): Vector3 { diff --git a/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/bone-active-link.kt b/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/bone-active-link.kt index a109c45b7..cb9cc30b9 100644 --- a/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/bone-active-link.kt +++ b/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/bone-active-link.kt @@ -16,10 +16,11 @@ class BoneActiveLinkInputProcessor : SkeletonInputProcessor { * Only active bones will be used. */ private val linkedToSources = arrayOf( - BodyPart.UPPER_CHEST to arrayOf(BodyPart.CHEST, BodyPart.WAIST, BodyPart.HIP), - BodyPart.CHEST to arrayOf(BodyPart.UPPER_CHEST, BodyPart.WAIST, BodyPart.HIP), - BodyPart.WAIST to arrayOf(BodyPart.CHEST, BodyPart.HIP, BodyPart.UPPER_CHEST), - BodyPart.HIP to arrayOf(BodyPart.WAIST, BodyPart.CHEST, BodyPart.UPPER_CHEST), + BodyPart.UPPER_CHEST to arrayOf(BodyPart.LOWER_CHEST, BodyPart.UPPER_WAIST, BodyPart.LOWER_WAIST, BodyPart.HIP), + BodyPart.LOWER_CHEST to arrayOf(BodyPart.UPPER_CHEST, BodyPart.UPPER_WAIST, BodyPart.LOWER_WAIST, BodyPart.HIP), + BodyPart.UPPER_WAIST to arrayOf(BodyPart.LOWER_WAIST, BodyPart.LOWER_CHEST, BodyPart.HIP, BodyPart.UPPER_CHEST), + BodyPart.LOWER_WAIST to arrayOf(BodyPart.UPPER_WAIST, BodyPart.LOWER_CHEST, BodyPart.HIP, BodyPart.UPPER_CHEST), + BodyPart.HIP to arrayOf(BodyPart.LOWER_WAIST, BodyPart.UPPER_WAIST, BodyPart.LOWER_CHEST, BodyPart.UPPER_CHEST), BodyPart.LEFT_BIG_TOE to arrayOf(BodyPart.LEFT_INDEX_TOE, BodyPart.LEFT_MIDDLE_TOE, BodyPart.LEFT_RING_TOE, BodyPart.LEFT_LITTLE_TOE, BodyPart.LEFT_FOOT), BodyPart.LEFT_INDEX_TOE to arrayOf(BodyPart.LEFT_MIDDLE_TOE, BodyPart.LEFT_RING_TOE, BodyPart.LEFT_LITTLE_TOE, BodyPart.LEFT_BIG_TOE, BodyPart.LEFT_FOOT), diff --git a/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/spine-impute.kt b/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/spine-impute.kt index 8a0dc4d89..598439662 100644 --- a/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/spine-impute.kt +++ b/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/spine-impute.kt @@ -8,46 +8,35 @@ import io.github.axisangles.ktmath.Quaternion import solarxr_protocol.datatypes.BodyPart // At this default value, the user's spine should behave as we meant it to. -const val DEFAULT_SPINE_RATIO = 0.5f +const val DEFAULT_SPINE_UPPER_LOWER = 0.5f private enum class SpineSource(val parts: Array) { - CHEST(arrayOf(BodyPart.CHEST)), + UPPER_CHEST(arrayOf(BodyPart.UPPER_CHEST)), + LOWER_CHEST(arrayOf(BodyPart.LOWER_CHEST)), + UPPER_WAIST(arrayOf(BodyPart.UPPER_WAIST)), + LOWER_WAIST(arrayOf(BodyPart.LOWER_WAIST)), HIP(arrayOf(BodyPart.HIP)), - WAIST(arrayOf(BodyPart.WAIST)), UPPER_LEGS(arrayOf(BodyPart.LEFT_UPPER_LEG, BodyPart.RIGHT_UPPER_LEG)), } -/** - * Returns the interpolation ratio modified with the reliability and curve. - * If a single bone is missing, ratio is reliability adjusted. - * At 0.0 curve, ratio is raw. - * At 0.5 curve, ratio is reliability adjusted. - * At 1.0 curve, ratio is 0 for the first in chain and 1 for the last in chain. - */ -private fun interpolateRatio(chainIndex: Int, chainSize: Int, fromUpperToLower: Float, curvature: Float, fromReliability: Float, toReliability: Float): Float { +private fun interpolateRatio(fromUpperToLower: Float, curvature: Float, fromReliability: Float, toReliability: Float): Float { + // Remap the upper-lower ratio with reliability val reliabilityAdjusted = remapRatioWithReliability(fromUpperToLower, fromReliability, toReliability) - if (chainSize <= 1) return reliabilityAdjusted // Single missing bone; reliability adjusted - return if (curvature <= DEFAULT_SPINE_RATIO) { - // Raw to reliability adjusted - FastMath.lerp(fromUpperToLower, reliabilityAdjusted, curvature * 2f) - } else { - // Reliability adjusted to max curve - val maxCurve = chainIndex / (chainSize - 1).toFloat() - FastMath.lerp(reliabilityAdjusted, maxCurve, (curvature - DEFAULT_SPINE_RATIO) * 2f) - } + // Lerp from upper-lower to reliability-adjusted according to curvature + return FastMath.lerp(fromUpperToLower, reliabilityAdjusted, curvature) } /** * Remaps a ratio This assumes a default ratio of 50%. */ private fun remapRatioWithReliability(ratio: Float, fromReliability: Float, toReliability: Float): Float { - val reliability = (fromReliability / toReliability) * DEFAULT_SPINE_RATIO + val reliability = (toReliability / fromReliability) * DEFAULT_SPINE_UPPER_LOWER - return if (ratio <= DEFAULT_SPINE_RATIO) { + return if (ratio <= DEFAULT_SPINE_UPPER_LOWER) { ratio * 2f * reliability } else { - reliability + (ratio - DEFAULT_SPINE_RATIO) * 2f * (1f - reliability) + reliability + (ratio - DEFAULT_SPINE_UPPER_LOWER) * 2f * (1f - reliability) } } @@ -59,16 +48,65 @@ private fun averageRotation(inputSkeleton: InputSkeleton, takeBodyParts: Array when (source) { - SpineSource.CHEST -> 0.6f - SpineSource.HIP, SpineSource.UPPER_LEGS -> 1.0f + BodyPart.LOWER_CHEST -> when (source) { + // From + SpineSource.UPPER_CHEST -> 10f + + // To + SpineSource.UPPER_WAIST -> -1.5f + + SpineSource.LOWER_WAIST -> -2f + + SpineSource.HIP -> -4f + + SpineSource.UPPER_LEGS -> -3f + + else -> error("Invalid spine combination $bodyPart, $source") + } + + BodyPart.UPPER_WAIST -> when (source) { + // From + SpineSource.UPPER_CHEST, SpineSource.LOWER_CHEST -> 10f + + // To + SpineSource.LOWER_WAIST -> 17f + + SpineSource.HIP -> 5.5f + + SpineSource.UPPER_LEGS -> 4.5f + + else -> error("Invalid spine combination $bodyPart, $source") + } + + BodyPart.LOWER_WAIST -> when (source) { + // From + SpineSource.UPPER_CHEST, SpineSource.LOWER_CHEST -> 6f + + SpineSource.UPPER_WAIST -> 6.25f + + // To + SpineSource.HIP -> 11f + + SpineSource.UPPER_LEGS -> 4.5f + else -> error("Invalid spine combination $bodyPart, $source") } BodyPart.HIP -> when (source) { - SpineSource.CHEST, SpineSource.UPPER_LEGS -> 1.0f - SpineSource.WAIST -> 0.8f + // From + SpineSource.UPPER_CHEST, SpineSource.LOWER_CHEST -> 9.5f + + SpineSource.UPPER_WAIST -> 12.5f + + SpineSource.LOWER_WAIST -> 13f + + // To + SpineSource.UPPER_LEGS -> 13f + else -> error("Invalid spine combination $bodyPart, $source") } @@ -85,22 +123,58 @@ class SpineImputeInputProcessor(val settings: Settings) : SkeletonInputProcessor override fun process(mutableInputSkeleton: InputSkeleton, skeletonHeight: Float) { val ratios = settings.context.state.value.data.skeletonConfig.ratios - val hasChest = mutableInputSkeleton[BodyPart.UPPER_CHEST]?.isRotationActive == true || mutableInputSkeleton[BodyPart.CHEST]?.isRotationActive == true - val hasWaist = mutableInputSkeleton[BodyPart.WAIST]?.isRotationActive == true + val hasUpperChest = mutableInputSkeleton[BodyPart.UPPER_CHEST]?.isRotationActive == true + val hasLowerChest = mutableInputSkeleton[BodyPart.LOWER_CHEST]?.isRotationActive == true + val hasUpperWaist = mutableInputSkeleton[BodyPart.UPPER_WAIST]?.isRotationActive == true + val hasLowerWaist = mutableInputSkeleton[BodyPart.LOWER_WAIST]?.isRotationActive == true val hasHip = mutableInputSkeleton[BodyPart.HIP]?.isRotationActive == true val hasUpperLegs = mutableInputSkeleton[BodyPart.LEFT_UPPER_LEG]?.isRotationActive == true && mutableInputSkeleton[BodyPart.RIGHT_UPPER_LEG]?.isRotationActive == true val missingSpineParts = buildList { - if (!hasWaist) add(BodyPart.WAIST) + if (!hasLowerChest) add(BodyPart.LOWER_CHEST) + if (!hasUpperWaist) add(BodyPart.UPPER_WAIST) + if (!hasLowerWaist) add(BodyPart.LOWER_WAIST) if (!hasHip) add(BodyPart.HIP) } - for ((chainIndex, bodyPart) in missingSpineParts.withIndex()) { + for (bodyPart in missingSpineParts) { val bone = mutableInputSkeleton[bodyPart] ?: continue // Get the first active bones above and below this one in the chain val (fromSource, toSource) = when (bodyPart) { - BodyPart.WAIST -> { - val from = SpineSource.CHEST.takeIf { hasChest } ?: continue + BodyPart.LOWER_CHEST -> { + val from = SpineSource.UPPER_CHEST.takeIf { hasUpperChest } ?: continue + val to = when { + hasUpperWaist -> SpineSource.UPPER_WAIST + hasLowerWaist -> SpineSource.LOWER_WAIST + hasHip -> SpineSource.HIP + hasUpperLegs -> SpineSource.UPPER_LEGS + else -> continue + } + from to to + } + + BodyPart.UPPER_WAIST -> { + val from = when { + hasLowerChest -> SpineSource.LOWER_CHEST + hasUpperChest -> SpineSource.UPPER_CHEST + else -> continue + } + val to = when { + hasLowerWaist -> SpineSource.LOWER_WAIST + hasHip -> SpineSource.HIP + hasUpperLegs -> SpineSource.UPPER_LEGS + else -> continue + } + from to to + } + + BodyPart.LOWER_WAIST -> { + val from = when { + hasUpperWaist -> SpineSource.UPPER_WAIST + hasLowerChest -> SpineSource.LOWER_CHEST + hasUpperChest -> SpineSource.UPPER_CHEST + else -> continue + } val to = when { hasHip -> SpineSource.HIP hasUpperLegs -> SpineSource.UPPER_LEGS @@ -111,8 +185,10 @@ class SpineImputeInputProcessor(val settings: Settings) : SkeletonInputProcessor BodyPart.HIP -> { val from = when { - hasWaist -> SpineSource.WAIST - hasChest -> SpineSource.CHEST + hasLowerWaist -> SpineSource.LOWER_WAIST + hasUpperWaist -> SpineSource.UPPER_WAIST + hasLowerChest -> SpineSource.LOWER_CHEST + hasUpperChest -> SpineSource.UPPER_CHEST else -> continue } val to = SpineSource.UPPER_LEGS.takeIf { hasUpperLegs } ?: continue @@ -123,8 +199,6 @@ class SpineImputeInputProcessor(val settings: Settings) : SkeletonInputProcessor } val interpolateRatio = interpolateRatio( - chainIndex, - missingSpineParts.size, ratios.imputeSpineFromUpperToLower, ratios.imputeSpineCurvature, reliabilityOf(bodyPart, fromSource), diff --git a/server/core/src/main/java/dev/slimevr/skeleton/proportions.kt b/server/core/src/main/java/dev/slimevr/skeleton/proportions.kt index b3074ffac..f2c8fa846 100644 --- a/server/core/src/main/java/dev/slimevr/skeleton/proportions.kt +++ b/server/core/src/main/java/dev/slimevr/skeleton/proportions.kt @@ -12,9 +12,10 @@ val DEFAULT_PROPORTIONS = mapOf( SkeletonBone.HEAD to 0.1f, SkeletonBone.NECK to 0.1f, SkeletonBone.UPPER_CHEST to 0.16f, - SkeletonBone.CHEST to 0.16f, - SkeletonBone.WAIST to 0.18f, - SkeletonBone.HIP to 0.06f, + SkeletonBone.LOWER_CHEST to 0.16f, + SkeletonBone.UPPER_WAIST to 0.1f, + SkeletonBone.LOWER_WAIST to 0.1f, + SkeletonBone.HIP to 0.04f, SkeletonBone.HIPS_WIDTH to 0.26f, SkeletonBone.UPPER_LEG to 0.42f, SkeletonBone.LOWER_LEG to 0.5f, @@ -33,8 +34,9 @@ val DEFAULT_PROPORTIONS = mapOf( private val HEIGHT_CONTRIBUTING_BONES: Set = setOf( SkeletonBone.NECK, SkeletonBone.UPPER_CHEST, - SkeletonBone.CHEST, - SkeletonBone.WAIST, + SkeletonBone.LOWER_CHEST, + SkeletonBone.UPPER_WAIST, + SkeletonBone.LOWER_WAIST, SkeletonBone.HIP, SkeletonBone.UPPER_LEG, SkeletonBone.LOWER_LEG, @@ -45,8 +47,9 @@ private val BONE_VALUE_TO_OFFSETS: Map> = map SkeletonBone.HEAD to BodyPartMap(mapOf(BodyPart.HEAD to Vector3.POS_Z)), SkeletonBone.NECK to BodyPartMap(mapOf(BodyPart.NECK to Vector3.NEG_Y)), SkeletonBone.UPPER_CHEST to BodyPartMap(mapOf(BodyPart.UPPER_CHEST to Vector3.NEG_Y)), - SkeletonBone.CHEST to BodyPartMap(mapOf(BodyPart.CHEST to Vector3.NEG_Y)), - SkeletonBone.WAIST to BodyPartMap(mapOf(BodyPart.WAIST to Vector3.NEG_Y)), + SkeletonBone.LOWER_CHEST to BodyPartMap(mapOf(BodyPart.LOWER_CHEST to Vector3.NEG_Y)), + SkeletonBone.UPPER_WAIST to BodyPartMap(mapOf(BodyPart.UPPER_WAIST to Vector3.NEG_Y)), + SkeletonBone.LOWER_WAIST to BodyPartMap(mapOf(BodyPart.LOWER_WAIST to Vector3.NEG_Y)), SkeletonBone.HIP to BodyPartMap(mapOf(BodyPart.HIP to Vector3.NEG_Y)), SkeletonBone.UPPER_LEG to BodyPartMap(mapOf(BodyPart.LEFT_UPPER_LEG to Vector3.NEG_Y, BodyPart.RIGHT_UPPER_LEG to Vector3.NEG_Y)), SkeletonBone.LOWER_LEG to BodyPartMap(mapOf(BodyPart.LEFT_LOWER_LEG to Vector3.NEG_Y, BodyPart.RIGHT_LOWER_LEG to Vector3.NEG_Y)), diff --git a/server/core/src/main/java/dev/slimevr/solarxr/driver/outgoing.kt b/server/core/src/main/java/dev/slimevr/solarxr/driver/outgoing.kt index e67f0a873..ab24f761d 100644 --- a/server/core/src/main/java/dev/slimevr/solarxr/driver/outgoing.kt +++ b/server/core/src/main/java/dev/slimevr/solarxr/driver/outgoing.kt @@ -45,8 +45,8 @@ class DriverOutgoingTrackersBehaviour( // physical tracker. Bones without an entry just report no battery. val bodyPartToNearest: BodyPartMap> = BodyPartMap( mapOf( - BodyPart.UPPER_CHEST to setOf(BodyPart.UPPER_CHEST, BodyPart.CHEST), - BodyPart.HIP to setOf(BodyPart.HIP, BodyPart.WAIST, BodyPart.CHEST, BodyPart.UPPER_CHEST), + BodyPart.UPPER_CHEST to setOf(BodyPart.UPPER_CHEST, BodyPart.LOWER_CHEST), + BodyPart.HIP to setOf(BodyPart.HIP, BodyPart.LOWER_WAIST, BodyPart.UPPER_WAIST, BodyPart.LOWER_CHEST, BodyPart.UPPER_CHEST), BodyPart.LEFT_UPPER_LEG to setOf(BodyPart.LEFT_UPPER_LEG), BodyPart.RIGHT_UPPER_LEG to setOf(BodyPart.RIGHT_UPPER_LEG), BodyPart.LEFT_FOOT to setOf(BodyPart.LEFT_FOOT, BodyPart.LEFT_LOWER_LEG), diff --git a/server/core/src/main/java/dev/slimevr/tapdetection/behaviours.kt b/server/core/src/main/java/dev/slimevr/tapdetection/behaviours.kt index 1261d27a2..25e0f4b97 100644 --- a/server/core/src/main/java/dev/slimevr/tapdetection/behaviours.kt +++ b/server/core/src/main/java/dev/slimevr/tapdetection/behaviours.kt @@ -33,11 +33,12 @@ class TapDetectionBasicBehaviour : TapDetectionBehaviour { var waitForLowAccel: Boolean = false, ) - // This vvv + the assigned tap body parts are used. + // This + the assigned tap body parts are used. private val falsePositiveBodyParts = setOf( BodyPart.UPPER_CHEST, - BodyPart.CHEST, - BodyPart.WAIST, + BodyPart.LOWER_CHEST, + BodyPart.UPPER_WAIST, + BodyPart.LOWER_WAIST, BodyPart.HIP, BodyPart.LEFT_UPPER_LEG, BodyPart.RIGHT_UPPER_LEG, @@ -79,11 +80,11 @@ class TapDetectionBasicBehaviour : TapDetectionBehaviour { .flatMapLatest { (tapDetectionConfig, setupMode, trackers) -> // Computed once per outer-flow refresh for all trackers val trackersBodyParts = trackers.map { it.context.state.value.bodyPart }.toSet() - val yawResetBodyPart = listOf(tapDetectionConfig.yawResetBodyPart, BodyPart.UPPER_CHEST, BodyPart.CHEST, BodyPart.HIP, BodyPart.WAIST) + val yawResetBodyPart = arrayOf(tapDetectionConfig.yawResetBodyPart, BodyPart.UPPER_CHEST, BodyPart.LOWER_CHEST, BodyPart.HIP, BodyPart.LOWER_WAIST, BodyPart.UPPER_WAIST) .firstOrNull { it in trackersBodyParts } ?: BodyPart.UPPER_CHEST - val fullResetBodyPart = listOf(tapDetectionConfig.fullResetBodyPart, BodyPart.LEFT_UPPER_LEG, BodyPart.LEFT_LOWER_LEG) + val fullResetBodyPart = arrayOf(tapDetectionConfig.fullResetBodyPart, BodyPart.LEFT_UPPER_LEG, BodyPart.LEFT_LOWER_LEG) .firstOrNull { it in trackersBodyParts } ?: BodyPart.LEFT_UPPER_LEG - val mountingResetBodyPart = listOf(tapDetectionConfig.mountingResetBodyPart, BodyPart.RIGHT_UPPER_LEG, BodyPart.RIGHT_LOWER_LEG) + val mountingResetBodyPart = arrayOf(tapDetectionConfig.mountingResetBodyPart, BodyPart.RIGHT_UPPER_LEG, BodyPart.RIGHT_LOWER_LEG) .firstOrNull { it in trackersBodyParts } ?: BodyPart.RIGHT_UPPER_LEG // To keep track of which trackers are moving diff --git a/server/core/src/main/java/dev/slimevr/tracker/stayaligned/body-parts.kt b/server/core/src/main/java/dev/slimevr/tracker/stayaligned/body-parts.kt index 335f6f82a..aa866efe8 100644 --- a/server/core/src/main/java/dev/slimevr/tracker/stayaligned/body-parts.kt +++ b/server/core/src/main/java/dev/slimevr/tracker/stayaligned/body-parts.kt @@ -13,8 +13,9 @@ object StayAlignedBodyParts { val upperBodyGroup = listOf( BodyPart.NECK, BodyPart.UPPER_CHEST, - BodyPart.CHEST, - BodyPart.WAIST, + BodyPart.LOWER_CHEST, + BodyPart.UPPER_WAIST, + BodyPart.LOWER_WAIST, BodyPart.HIP, ) val upperBodyOrder = upperBodyGroup.withIndex().associate { it.value to it.index } diff --git a/server/core/src/main/java/dev/slimevr/vmc/mapping.kt b/server/core/src/main/java/dev/slimevr/vmc/mapping.kt index ac751d8c1..2db5fbcf7 100644 --- a/server/core/src/main/java/dev/slimevr/vmc/mapping.kt +++ b/server/core/src/main/java/dev/slimevr/vmc/mapping.kt @@ -7,13 +7,14 @@ import io.github.axisangles.ktmath.Quaternion import io.github.axisangles.ktmath.Vector3 import solarxr_protocol.datatypes.BodyPart +// TODO how to handle UPPER_WAIST? val BODY_PART_TO_UNITY_BONE: BodyPartMap> = BodyPartMap( mapOf( 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.LOWER_CHEST to arrayOf("Chest"), + BodyPart.LOWER_WAIST to arrayOf("Spine"), BodyPart.HIP to arrayOf("Hips"), BodyPart.LEFT_SHOULDER to arrayOf("LeftShoulder"), BodyPart.RIGHT_SHOULDER to arrayOf("RightShoulder"), @@ -80,9 +81,9 @@ val VMC_SUPPORTED_BONES: Set = BODY_PART_TO_UNITY_BONE.keys // and figure out how to deal with it (check if present in VRM?) val VMC_HIERARCHY_MAP: BodyPartMap> = BodyPartMap( mapOf( - BodyPart.HIP to arrayOf(BodyPart.WAIST, BodyPart.LEFT_UPPER_LEG, BodyPart.RIGHT_UPPER_LEG), - BodyPart.WAIST to arrayOf(BodyPart.CHEST), - BodyPart.CHEST to arrayOf(BodyPart.UPPER_CHEST, BodyPart.NECK, BodyPart.LEFT_SHOULDER, BodyPart.RIGHT_SHOULDER), + BodyPart.HIP to arrayOf(BodyPart.LOWER_WAIST, BodyPart.LEFT_UPPER_LEG, BodyPart.RIGHT_UPPER_LEG), + BodyPart.LOWER_WAIST to arrayOf(BodyPart.LOWER_CHEST), + BodyPart.LOWER_CHEST to arrayOf(BodyPart.UPPER_CHEST, BodyPart.NECK, BodyPart.LEFT_SHOULDER, BodyPart.RIGHT_SHOULDER), BodyPart.NECK to arrayOf(BodyPart.HEAD), BodyPart.LEFT_UPPER_LEG to arrayOf(BodyPart.LEFT_LOWER_LEG), BodyPart.RIGHT_UPPER_LEG to arrayOf(BodyPart.RIGHT_LOWER_LEG), @@ -165,7 +166,7 @@ val VMC_OUTPUT_BONE_PARENTS: BodyPartMap = VmcBoneTree(VMC_HIERARCHY_ val VMC_INPUT_HIERARCHY_MAP: BodyPartMap> = BodyPartMap( VMC_HIERARCHY_MAP + mapOf( - BodyPart.CHEST to arrayOf(BodyPart.UPPER_CHEST), + BodyPart.LOWER_CHEST to arrayOf(BodyPart.UPPER_CHEST), BodyPart.UPPER_CHEST to arrayOf(BodyPart.NECK, BodyPart.LEFT_SHOULDER, BodyPart.RIGHT_SHOULDER), ), ) diff --git a/server/core/src/main/java/dev/slimevr/vmc/vrm.kt b/server/core/src/main/java/dev/slimevr/vmc/vrm.kt index 364c095d4..b20be4ea7 100644 --- a/server/core/src/main/java/dev/slimevr/vmc/vrm.kt +++ b/server/core/src/main/java/dev/slimevr/vmc/vrm.kt @@ -109,8 +109,8 @@ fun buildVrmGeometry(reader: VrmReader): VrmGeometry { val vrmHeight = ( offset(BodyPart.HIP) + - offset(BodyPart.WAIST) + - offset(BodyPart.CHEST) + + offset(BodyPart.LOWER_WAIST) + + offset(BodyPart.LOWER_CHEST) + offset(BodyPart.UPPER_CHEST) + offset(BodyPart.NECK) ).y diff --git a/server/core/src/test/java/dev/slimevr/routing/CandidateBonesTest.kt b/server/core/src/test/java/dev/slimevr/routing/CandidateBonesTest.kt index eda1aec5a..46bb6e3d5 100644 --- a/server/core/src/test/java/dev/slimevr/routing/CandidateBonesTest.kt +++ b/server/core/src/test/java/dev/slimevr/routing/CandidateBonesTest.kt @@ -28,16 +28,16 @@ class CandidateBonesTest { ), ), TestCase( - name = "chest enables upper chest and hip", - fineBodyParts = setOf(BodyPart.CHEST), + name = "lower chest enables upper chest and hip", + fineBodyParts = setOf(BodyPart.LOWER_CHEST), expected = setOf( BodyPart.UPPER_CHEST, BodyPart.HIP, ), ), TestCase( - name = "waist enables hip", - fineBodyParts = setOf(BodyPart.WAIST), + name = "lower waist enables hip", + fineBodyParts = setOf(BodyPart.LOWER_WAIST), expected = setOf( BodyPart.HIP, ), diff --git a/server/core/src/test/java/dev/slimevr/skeleton/IKTest.kt b/server/core/src/test/java/dev/slimevr/skeleton/IKTest.kt index 36ab0dba5..48e62ca6c 100644 --- a/server/core/src/test/java/dev/slimevr/skeleton/IKTest.kt +++ b/server/core/src/test/java/dev/slimevr/skeleton/IKTest.kt @@ -18,12 +18,16 @@ class IKTest { bodyPart = BodyPart.UPPER_CHEST, offset = Vector3.NEG_Y, ) - boneInputs[BodyPart.CHEST] = DEFAULT_BONE_INPUT.copy( - bodyPart = BodyPart.CHEST, + boneInputs[BodyPart.LOWER_CHEST] = DEFAULT_BONE_INPUT.copy( + bodyPart = BodyPart.LOWER_CHEST, offset = Vector3.NEG_Y, ) - boneInputs[BodyPart.WAIST] = DEFAULT_BONE_INPUT.copy( - bodyPart = BodyPart.WAIST, + boneInputs[BodyPart.UPPER_WAIST] = DEFAULT_BONE_INPUT.copy( + bodyPart = BodyPart.UPPER_WAIST, + offset = Vector3.NEG_Y, + ) + boneInputs[BodyPart.LOWER_WAIST] = DEFAULT_BONE_INPUT.copy( + bodyPart = BodyPart.LOWER_WAIST, offset = Vector3.NEG_Y, ) boneInputs[BodyPart.HIP] = DEFAULT_BONE_INPUT.copy( @@ -32,13 +36,14 @@ class IKTest { ) val bones = buildBones(boneInputs) - val target = Vector3.POS_X * 4f + val target = Vector3.POS_X * 3f val goal = IKChainGoal( listOf( BodyPart.NECK, BodyPart.UPPER_CHEST, - BodyPart.CHEST, - BodyPart.WAIST, + BodyPart.LOWER_CHEST, + BodyPart.UPPER_WAIST, + BodyPart.LOWER_WAIST, BodyPart.HIP, ), target, diff --git a/server/core/src/test/java/dev/slimevr/tracker/YawResetSmoothingTest.kt b/server/core/src/test/java/dev/slimevr/tracker/YawResetSmoothingTest.kt index 4222e1c35..a2fe9b2e8 100644 --- a/server/core/src/test/java/dev/slimevr/tracker/YawResetSmoothingTest.kt +++ b/server/core/src/test/java/dev/slimevr/tracker/YawResetSmoothingTest.kt @@ -34,7 +34,7 @@ class YawResetSmoothingTest { appContext, settings, id = 0, - bodyPart = BodyPart.CHEST, + bodyPart = BodyPart.LOWER_CHEST, status = TrackerStatus.OK, rawRotation = raw, additionalBehaviours = listOf(TrackerYawResetSmoothingBehaviour()), diff --git a/server/core/src/test/java/dev/slimevr/trackingchecklist/TrackingChecklistTest.kt b/server/core/src/test/java/dev/slimevr/trackingchecklist/TrackingChecklistTest.kt index 4ccd3c799..419132e09 100644 --- a/server/core/src/test/java/dev/slimevr/trackingchecklist/TrackingChecklistTest.kt +++ b/server/core/src/test/java/dev/slimevr/trackingchecklist/TrackingChecklistTest.kt @@ -113,7 +113,7 @@ class TrackingChecklistTest { @Test fun `FULL_RESET flags a connected assigned tracker and clears on full reset`() = runTest { val h = Harness(this) - val tracker = h.addTracker(bodyPart = BodyPart.CHEST) + val tracker = h.addTracker(bodyPart = BodyPart.LOWER_CHEST) runCurrent() assertEquals(true, h.step(TrackingChecklistStepId.FULL_RESET).enabled) @@ -132,7 +132,7 @@ class TrackingChecklistTest { @Test fun `FULL_RESET flags a tracker that reconnects`() = runTest { val h = Harness(this) - val tracker = h.addTracker(bodyPart = BodyPart.CHEST) + val tracker = h.addTracker(bodyPart = BodyPart.LOWER_CHEST) runCurrent() h.resetsManager.context.dispatch(ResetsActions.EndReset(ResetType.FULL)) runCurrent() @@ -150,7 +150,7 @@ class TrackingChecklistTest { @Test fun `adding a tracker does not re-flag the existing already-reset trackers`() = runTest { val h = Harness(this) - h.addTracker(bodyPart = BodyPart.CHEST) + h.addTracker(bodyPart = BodyPart.LOWER_CHEST) runCurrent() h.resetsManager.context.dispatch(ResetsActions.EndReset(ResetType.FULL)) runCurrent() @@ -172,7 +172,7 @@ class TrackingChecklistTest { @Test fun `MOUNTING_CALIBRATION is enabled with an IMU tracker and valid after a mounting reset`() = runTest { val h = Harness(this) - h.addTracker(bodyPart = BodyPart.CHEST) + h.addTracker(bodyPart = BodyPart.LOWER_CHEST) runCurrent() assertEquals(true, h.step(TrackingChecklistStepId.MOUNTING_CALIBRATION).enabled) @@ -200,7 +200,7 @@ class TrackingChecklistTest { @Test fun `FEET_MOUNTING_CALIBRATION is disabled without a foot tracker`() = runTest { val h = Harness(this) - h.addTracker(bodyPart = BodyPart.CHEST) + h.addTracker(bodyPart = BodyPart.LOWER_CHEST) runCurrent() assertEquals(false, h.step(TrackingChecklistStepId.FEET_MOUNTING_CALIBRATION).enabled) @@ -224,7 +224,7 @@ class TrackingChecklistTest { @Test fun `UNASSIGNED_HMD is disabled without a driver tracker`() = runTest { val h = Harness(this) - h.addTracker(bodyPart = BodyPart.CHEST) + h.addTracker(bodyPart = BodyPart.LOWER_CHEST) runCurrent() assertEquals(false, h.step(TrackingChecklistStepId.UNASSIGNED_HMD).enabled) @@ -233,7 +233,7 @@ class TrackingChecklistTest { @Test fun `TRACKER_ERROR is invalid while an assigned tracker is in error`() = runTest { val h = Harness(this) - val tracker = h.addTracker(bodyPart = BodyPart.CHEST, status = TrackerStatus.ERROR) + val tracker = h.addTracker(bodyPart = BodyPart.LOWER_CHEST, status = TrackerStatus.ERROR) runCurrent() assertEquals(true, h.step(TrackingChecklistStepId.TRACKER_ERROR).enabled) @@ -247,7 +247,7 @@ class TrackingChecklistTest { @Test fun `TRACKERS_REST_CALIBRATION is invalid until an uncalibrated tracker finishes rest calibration`() = runTest { val h = Harness(this) - val tracker = h.addTracker(bodyPart = BodyPart.CHEST, completedRestCalibration = false) + val tracker = h.addTracker(bodyPart = BodyPart.LOWER_CHEST, completedRestCalibration = false) runCurrent() assertEquals(true, h.step(TrackingChecklistStepId.TRACKERS_REST_CALIBRATION).enabled) diff --git a/server/core/src/test/java/dev/slimevr/vmc/InputDecoderTest.kt b/server/core/src/test/java/dev/slimevr/vmc/InputDecoderTest.kt index 6d0926e73..d216c5c6b 100644 --- a/server/core/src/test/java/dev/slimevr/vmc/InputDecoderTest.kt +++ b/server/core/src/test/java/dev/slimevr/vmc/InputDecoderTest.kt @@ -124,8 +124,8 @@ class InputDecoderTest { val bones = BodyPartMap( mapOf( BodyPart.HIP to bone(BodyPart.HIP, Quaternion.rotationAroundYAxis(0.1f), Vector3.ZERO), - BodyPart.WAIST to bone(BodyPart.WAIST, Quaternion.rotationAroundXAxis(0.2f), Vector3(0f, 0.15f, 0f)), - BodyPart.CHEST to bone(BodyPart.CHEST, chestRotation, chestHead), + BodyPart.LOWER_WAIST to bone(BodyPart.LOWER_WAIST, Quaternion.rotationAroundXAxis(0.2f), Vector3(0f, 0.15f, 0f)), + BodyPart.LOWER_CHEST to bone(BodyPart.LOWER_CHEST, chestRotation, chestHead), BodyPart.UPPER_CHEST to bone(BodyPart.UPPER_CHEST, chestRotation, chestHead), BodyPart.NECK to bone(BodyPart.NECK, Quaternion.rotationAroundZAxis(0.15f), Vector3(0f, 0.5f, 0f)), BodyPart.HEAD to bone(BodyPart.HEAD, Quaternion.rotationAroundXAxis(-0.1f), Vector3(0f, 0.65f, 0f)), diff --git a/server/core/src/test/java/dev/slimevr/vmc/OutputEncoderTest.kt b/server/core/src/test/java/dev/slimevr/vmc/OutputEncoderTest.kt index 47bb5f5bd..f78e58dda 100644 --- a/server/core/src/test/java/dev/slimevr/vmc/OutputEncoderTest.kt +++ b/server/core/src/test/java/dev/slimevr/vmc/OutputEncoderTest.kt @@ -60,7 +60,7 @@ class OutputEncoderTest { val bones = BodyPartMap( mapOf( BodyPart.HIP to bone(BodyPart.HIP), - BodyPart.WAIST to bone(BodyPart.WAIST), + BodyPart.LOWER_WAIST to bone(BodyPart.LOWER_WAIST), ), ) @@ -80,7 +80,7 @@ class OutputEncoderTest { fun testSkipsRoutedBonesMissingFromTheSkeleton() { val bundle = buildOutgoingBundle( bones = BodyPartMap(mapOf(BodyPart.HIP to bone(BodyPart.HIP))), - routedBones = setOf(BodyPart.HIP, BodyPart.WAIST), + routedBones = setOf(BodyPart.HIP, BodyPart.LOWER_WAIST), config = defaultConfig, vrm = null, elapsed = 0.seconds, @@ -122,10 +122,10 @@ class OutputEncoderTest { val bones = BodyPartMap( mapOf( BodyPart.HIP to bone(BodyPart.HIP), - BodyPart.WAIST to bone(BodyPart.WAIST), + BodyPart.LOWER_WAIST to bone(BodyPart.LOWER_WAIST), ), ) - val routed = setOf(BodyPart.HIP, BodyPart.WAIST) + val routed = setOf(BodyPart.HIP, BodyPart.LOWER_WAIST) val vrm = buildVrmGeometry(VrmReader(VRM_JSON)) val bundle = buildOutgoingBundle(bones, routed, defaultConfig, vrm, 0.seconds) diff --git a/solarxr-protocol b/solarxr-protocol index 509309fc9..f9790f8da 160000 --- a/solarxr-protocol +++ b/solarxr-protocol @@ -1 +1 @@ -Subproject commit 509309fc9dbe12d9e76bb9d16c9dc8d0875a8ae6 +Subproject commit f9790f8daa7609df99f91d80c007faeb2a591c1e