mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-21 17:41:28 -08:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31ffd6e418 |
No files matched your search
@@ -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
|
||||
|
||||
@@ -72,7 +72,7 @@ export const mapPart: Record<
|
||||
}) => JSX.Element
|
||||
> = {
|
||||
[BodyPart.UPPER_CHEST]: ({ width }) => <UpperChestIcon width={width} />,
|
||||
[BodyPart.CHEST]: ({ width }) => <ChestIcon width={width} />,
|
||||
[BodyPart.LOWER_CHEST]: ({ width }) => <ChestIcon width={width} />,
|
||||
[BodyPart.HEAD]: ({ width }) => <HeadsetIcon width={width} />,
|
||||
[BodyPart.HIP]: ({ width }) => <HipIcon width={width} />,
|
||||
[BodyPart.LEFT_FOOT]: ({ width, currentLocales }) =>
|
||||
@@ -111,7 +111,8 @@ export const mapPart: Record<
|
||||
[BodyPart.RIGHT_UPPER_LEG]: ({ width }) => (
|
||||
<UpperLegIcon width={width} flipped />
|
||||
),
|
||||
[BodyPart.WAIST]: ({ width }) => <WaistIcon width={width} />,
|
||||
[BodyPart.UPPER_WAIST]: ({ width }) => <WaistIcon width={width} />,
|
||||
[BodyPart.LOWER_WAIST]: ({ width }) => <WaistIcon width={width} />,
|
||||
[BodyPart.LEFT_THUMB_METACARPAL]: ({ width }) => (
|
||||
<FingersIcon width={width} />
|
||||
),
|
||||
|
||||
@@ -53,16 +53,16 @@ export function PersonFrontIcon({
|
||||
<circle
|
||||
className="body-part-circle"
|
||||
cx="82"
|
||||
cy="90"
|
||||
cy="105"
|
||||
r={CIRCLE_RADIUS}
|
||||
id={BodyPart[BodyPart.UPPER_CHEST]}
|
||||
/>
|
||||
<circle
|
||||
className="body-part-circle"
|
||||
cx="82"
|
||||
cy="105"
|
||||
cy="120"
|
||||
r={CIRCLE_RADIUS}
|
||||
id={BodyPart[BodyPart.CHEST]}
|
||||
id={BodyPart[BodyPart.LOWER_CHEST]}
|
||||
/>
|
||||
<circle
|
||||
className="body-part-circle"
|
||||
@@ -71,12 +71,19 @@ export function PersonFrontIcon({
|
||||
r={CIRCLE_RADIUS}
|
||||
id={BodyPart[BodyPart.HIP]}
|
||||
/>
|
||||
<circle
|
||||
className="body-part-circle"
|
||||
cx="82"
|
||||
cy="140"
|
||||
r={CIRCLE_RADIUS}
|
||||
id={BodyPart[BodyPart.UPPER_WAIST]}
|
||||
/>
|
||||
<circle
|
||||
className="body-part-circle"
|
||||
cx="82"
|
||||
cy="155"
|
||||
r={CIRCLE_RADIUS}
|
||||
id={BodyPart[BodyPart.WAIST]}
|
||||
id={BodyPart[BodyPart.LOWER_WAIST]}
|
||||
/>
|
||||
<circle
|
||||
className="body-part-circle"
|
||||
|
||||
@@ -49,10 +49,10 @@ const LEFT_GROUPS = (side: BodySide): BodyPart[][] => [
|
||||
];
|
||||
|
||||
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],
|
||||
];
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 = [
|
||||
|
||||
@@ -38,9 +38,10 @@ const BONE_MAPPING: Map<string, SkeletonBone[]> = 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]],
|
||||
|
||||
@@ -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<Record<BodyPart, (BodyPart | BodyPart[])[]>> = {
|
||||
@@ -54,8 +55,9 @@ export const ASSIGNMENT_RULES: Partial<Record<BodyPart, (BodyPart | BodyPart[])[
|
||||
[BodyPart.RIGHT_LOWER_LEG]: [BodyPart.RIGHT_UPPER_LEG, SPINE_PARTS],
|
||||
[BodyPart.LEFT_UPPER_LEG]: [SPINE_PARTS],
|
||||
[BodyPart.RIGHT_UPPER_LEG]: [SPINE_PARTS],
|
||||
[BodyPart.HIP]: [BodyPart.CHEST],
|
||||
[BodyPart.WAIST]: [BodyPart.CHEST],
|
||||
[BodyPart.HIP]: [BodyPart.UPPER_CHEST],
|
||||
[BodyPart.LOWER_WAIST]: [BodyPart.UPPER_CHEST],
|
||||
[BodyPart.UPPER_WAIST]: [BodyPart.UPPER_CHEST],
|
||||
// TODO chest OR upperChest.
|
||||
// Also don't warn if no legs.
|
||||
};
|
||||
@@ -77,7 +79,7 @@ export const ALL_ASSIGNABLE_PARTS = [
|
||||
];
|
||||
|
||||
export const TAP_DETECTION_BODY_PARTS = [
|
||||
BodyPart.CHEST,
|
||||
BodyPart.UPPER_CHEST,
|
||||
BodyPart.HIP,
|
||||
BodyPart.LEFT_UPPER_ARM,
|
||||
BodyPart.RIGHT_UPPER_ARM,
|
||||
@@ -95,13 +97,13 @@ export const getSuggestedBodyParts = (
|
||||
): BodyPart[] => {
|
||||
const parts = new Set<BodyPart>();
|
||||
|
||||
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;
|
||||
|
||||
@@ -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'],
|
||||
|
||||
@@ -257,16 +257,28 @@ export const SKELETON_PART_PRESETS: Record<BodyPart, BonePartConfig> = {
|
||||
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 }
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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.
|
||||
)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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)),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -48,11 +48,15 @@ val BODY_PART_CONSTRAINT_MAP: BodyPartMap<Constraint> = 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,
|
||||
),
|
||||
|
||||
@@ -23,8 +23,9 @@ val BODY_PART_IK_CHAIN_MAP: BodyPartMap<IKChain> = 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(
|
||||
|
||||
@@ -51,9 +51,10 @@ val BODY_PART_HIERARCHY_MAP: BodyPartMap<Array<BodyPart>> = 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),
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -11,9 +11,10 @@ import solarxr_protocol.datatypes.BodyPart
|
||||
const val DEFAULT_SPINE_RATIO = 0.5f
|
||||
|
||||
private enum class SpineSource(val parts: Array<BodyPart>) {
|
||||
CHEST(arrayOf(BodyPart.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)),
|
||||
}
|
||||
|
||||
@@ -42,7 +43,7 @@ private fun interpolateRatio(chainIndex: Int, chainSize: Int, fromUpperToLower:
|
||||
* 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_RATIO
|
||||
|
||||
return if (ratio <= DEFAULT_SPINE_RATIO) {
|
||||
ratio * 2f * reliability
|
||||
@@ -60,15 +61,45 @@ private fun averageRotation(inputSkeleton: InputSkeleton, takeBodyParts: Array<B
|
||||
}
|
||||
|
||||
private fun reliabilityOf(bodyPart: BodyPart, source: SpineSource): Float = when (bodyPart) {
|
||||
BodyPart.WAIST -> when (source) {
|
||||
SpineSource.CHEST -> 0.6f
|
||||
SpineSource.HIP, SpineSource.UPPER_LEGS -> 1.0f
|
||||
BodyPart.UPPER_WAIST -> when (source) {
|
||||
// From
|
||||
SpineSource.LOWER_CHEST -> 1f
|
||||
|
||||
// To
|
||||
SpineSource.LOWER_WAIST -> 1.2f
|
||||
|
||||
SpineSource.HIP -> 0.45f
|
||||
|
||||
SpineSource.UPPER_LEGS -> 0.4f
|
||||
|
||||
else -> error("Invalid spine combination $bodyPart, $source")
|
||||
}
|
||||
|
||||
BodyPart.LOWER_WAIST -> when (source) {
|
||||
// From
|
||||
SpineSource.LOWER_CHEST -> 1f
|
||||
|
||||
SpineSource.UPPER_WAIST -> 1.2f
|
||||
|
||||
// To
|
||||
SpineSource.HIP -> 0.75f
|
||||
|
||||
SpineSource.UPPER_LEGS -> 0.7f
|
||||
|
||||
else -> error("Invalid spine combination $bodyPart, $source")
|
||||
}
|
||||
|
||||
BodyPart.HIP -> when (source) {
|
||||
SpineSource.CHEST, SpineSource.UPPER_LEGS -> 1.0f
|
||||
SpineSource.WAIST -> 0.8f
|
||||
// From
|
||||
SpineSource.LOWER_CHEST -> 1.25f
|
||||
|
||||
SpineSource.LOWER_WAIST -> 1.3f
|
||||
|
||||
SpineSource.UPPER_WAIST -> 1.35f
|
||||
|
||||
// To
|
||||
SpineSource.UPPER_LEGS -> 1.6f
|
||||
|
||||
else -> error("Invalid spine combination $bodyPart, $source")
|
||||
}
|
||||
|
||||
@@ -85,12 +116,14 @@ 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 hasChest = mutableInputSkeleton[BodyPart.UPPER_CHEST]?.isRotationActive == true || 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 (!hasUpperWaist) add(BodyPart.UPPER_WAIST)
|
||||
if (!hasLowerWaist) add(BodyPart.LOWER_WAIST)
|
||||
if (!hasHip) add(BodyPart.HIP)
|
||||
}
|
||||
|
||||
@@ -99,8 +132,23 @@ class SpineImputeInputProcessor(val settings: Settings) : SkeletonInputProcessor
|
||||
|
||||
// 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.UPPER_WAIST -> {
|
||||
val from = SpineSource.LOWER_CHEST.takeIf { hasChest } ?: 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
|
||||
hasChest -> SpineSource.LOWER_CHEST
|
||||
else -> continue
|
||||
}
|
||||
val to = when {
|
||||
hasHip -> SpineSource.HIP
|
||||
hasUpperLegs -> SpineSource.UPPER_LEGS
|
||||
@@ -111,8 +159,9 @@ 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
|
||||
hasChest -> SpineSource.LOWER_CHEST
|
||||
else -> continue
|
||||
}
|
||||
val to = SpineSource.UPPER_LEGS.takeIf { hasUpperLegs } ?: continue
|
||||
|
||||
@@ -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<SkeletonBone> = 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<SkeletonBone, BodyPartMap<Vector3>> = 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)),
|
||||
|
||||
@@ -45,8 +45,8 @@ class DriverOutgoingTrackersBehaviour(
|
||||
// physical tracker. Bones without an entry just report no battery.
|
||||
val bodyPartToNearest: BodyPartMap<Set<BodyPart>> = 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),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -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<Array<String>> = 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<BodyPart> = BODY_PART_TO_UNITY_BONE.keys
|
||||
// and figure out how to deal with it (check if present in VRM?)
|
||||
val VMC_HIERARCHY_MAP: BodyPartMap<Array<BodyPart>> = 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<BodyPart?> = VmcBoneTree(VMC_HIERARCHY_
|
||||
val VMC_INPUT_HIERARCHY_MAP: BodyPartMap<Array<BodyPart>> = 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),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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()),
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)),
|
||||
|
||||
@@ -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)
|
||||
|
||||
+1
-1
Submodule solarxr-protocol updated: 509309fc9d...f9790f8daa.
Reference in new issue
Block a user