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 8000f01e8..5b0b527d9 100644 --- a/server/core/src/main/java/dev/slimevr/config/settings.kt +++ b/server/core/src/main/java/dev/slimevr/config/settings.kt @@ -120,7 +120,7 @@ data class SkeletonRatiosConfig( val predictionStrength: Float = 0.30f, val spineCurvature: Float = 0.75f, val imputeSpineFromUpperToLower: Float = DEFAULT_SPINE_UPPER_LOWER, - val interpolateUpperLegsTwistWithLowerLegs: Float = 0.8f, + val interpolateUpperLegsTwistWithLowerLegs: Float = 0.85f, val skatingCorrectionStrength: Float = 0.5f, ) diff --git a/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/upper-legs-roll-align.kt b/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/upper-legs-twist.kt similarity index 84% rename from server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/upper-legs-roll-align.kt rename to server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/upper-legs-twist.kt index e6d6ec3d4..de88807ad 100644 --- a/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/upper-legs-roll-align.kt +++ b/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/upper-legs-twist.kt @@ -4,6 +4,7 @@ import dev.slimevr.config.Settings import dev.slimevr.skeleton.InputSkeleton import dev.slimevr.skeleton.SkeletonInputProcessor import io.github.axisangles.ktmath.Quaternion +import io.github.axisangles.ktmath.Vector3 import solarxr_protocol.datatypes.BodyPart /** @@ -15,19 +16,18 @@ import solarxr_protocol.datatypes.BodyPart * @return the rotated Quaternion */ private fun alignRoll(from: Quaternion, to: Quaternion): Quaternion { - val r = to.inv() * from - val c = Quaternion(r.w, 0f, -r.y, 0f) - return (to * r * c).unit() + val local = to.localAbout(from) + val roll = local.project(Vector3.POS_Y).unit() + return roll.globalAbout(from) } /** * Handles rotating the upper legs' roll to match the lower legs' roll. */ -class UpperLegsRollAlignInputProcessor(val settings: Settings) : SkeletonInputProcessor { +class UpperLegsTwistInputProcessor(val settings: Settings) : SkeletonInputProcessor { /** * First value is the BodyPart to be aligned. - * - * Second value is a source BodyPart + * Second value is the source BodyPart. */ private val bodyPartToSources = arrayOf( BodyPart.LEFT_UPPER_LEG to BodyPart.LEFT_LOWER_LEG, diff --git a/server/core/src/main/java/dev/slimevr/skeleton/module.kt b/server/core/src/main/java/dev/slimevr/skeleton/module.kt index e36c17e96..1ca762ed8 100644 --- a/server/core/src/main/java/dev/slimevr/skeleton/module.kt +++ b/server/core/src/main/java/dev/slimevr/skeleton/module.kt @@ -19,7 +19,7 @@ import dev.slimevr.skeleton.inputprocessors.HeadPositionFallbackInputProcessor import dev.slimevr.skeleton.inputprocessors.NeckInputProcessor import dev.slimevr.skeleton.inputprocessors.SpineInputProcessor import dev.slimevr.skeleton.inputprocessors.ToesInputProcessor -import dev.slimevr.skeleton.inputprocessors.UpperLegsRollAlignInputProcessor +import dev.slimevr.skeleton.inputprocessors.UpperLegsTwistInputProcessor import dev.slimevr.skeleton.targetprocessors.FloorClipTargetProcessor import dev.slimevr.skeleton.targetprocessors.PositionalTargetProcessor import dev.slimevr.skeleton.targetprocessors.SkatingCorrectionTargetProcessor @@ -285,7 +285,7 @@ class Skeleton( FingersInputProcessor(), ToesInputProcessor(), ConstraintInputProcessor(settings), - UpperLegsRollAlignInputProcessor(settings), + UpperLegsTwistInputProcessor(settings), ), // Run on the result of FK and persist fkComputedProcessors = listOf(