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 b205d5636..438935976 100644 --- a/server/core/src/main/java/dev/slimevr/vmc/mapping.kt +++ b/server/core/src/main/java/dev/slimevr/vmc/mapping.kt @@ -97,8 +97,8 @@ private val VMC_TREE = VmcBoneTree(VMC_HIERARCHY) val VMC_BONE_ORDER: List = VMC_TREE.order val VMC_BONE_PARENTS: EnumMap = VMC_TREE.parents -// Bones between the hips and the neck, hips first, as VMC's hierarchy links them. -val VMC_HIP_TO_NECK_CHAIN: List = generateSequence(UnityBone.NECK) { VMC_BONE_PARENTS[it] } +// Bones between the hips and the head, hips first, as VMC's hierarchy links them. +val VMC_HIP_TO_HEAD_CHAIN: List = generateSequence(UnityBone.HEAD) { VMC_BONE_PARENTS[it] } .takeWhile { it != UnityBone.HIPS } .toList() .asReversed() diff --git a/server/core/src/main/java/dev/slimevr/vmc/output-encoder.kt b/server/core/src/main/java/dev/slimevr/vmc/output-encoder.kt index a64dddd66..07d9cffe6 100644 --- a/server/core/src/main/java/dev/slimevr/vmc/output-encoder.kt +++ b/server/core/src/main/java/dev/slimevr/vmc/output-encoder.kt @@ -158,7 +158,7 @@ private fun hipToNeckOffset( ): Vector3 { var parentUnityBone = UnityBone.HIPS var offset = Vector3.ZERO - for (childUnityBone in VMC_HIP_TO_NECK_CHAIN) { + for (childUnityBone in VMC_HIP_TO_HEAD_CHAIN) { val parentRotation = unityBoneGlobalRotations[parentUnityBone] ?: Quaternion.IDENTITY val bonePosition = unityBoneGlobalPositions[childUnityBone] ?: Vector3.ZERO val parentPosition = unityBoneGlobalPositions[parentUnityBone] ?: Vector3.ZERO 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 e3b82ebcd..c48198878 100644 --- a/server/core/src/main/java/dev/slimevr/vmc/vrm.kt +++ b/server/core/src/main/java/dev/slimevr/vmc/vrm.kt @@ -111,7 +111,7 @@ fun buildVrmGeometry(reader: VrmReader): VrmGeometry { acc + offset(unityBone) }.y - val outputRestHeight = hipPosition.y + VMC_HIP_TO_NECK_CHAIN.sumOf { offset(it).y.toDouble() }.toFloat() + val outputRestHeight = hipPosition.y + VMC_HIP_TO_HEAD_CHAIN.sumOf { offset(it).y.toDouble() }.toFloat() return VrmGeometry( bindOffsets = bindOffsets,