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 210eac9af..7c704b6f5 100644 --- a/server/core/src/main/java/dev/slimevr/config/settings.kt +++ b/server/core/src/main/java/dev/slimevr/config/settings.kt @@ -116,8 +116,8 @@ data class SkeletonTogglesConfig( // Used in SkeletonConfig @Serializable data class SkeletonRatiosConfig( - val smoothingStrength: Float = 0.15f, - val predictionStrength: Float = 0.3f, + val smoothingStrength: Float = 0.10f, + val predictionStrength: Float = 0.35f, val spineCurvature: Float = 0.75f, val imputeSpineFromUpperToLower: Float = DEFAULT_SPINE_UPPER_LOWER, val interpolateUpperLegsTwistWithLowerLegs: Float = 0.85f, diff --git a/server/core/src/main/java/dev/slimevr/skeleton/computedprocessors/velocity.kt b/server/core/src/main/java/dev/slimevr/skeleton/computedprocessors/velocity.kt index 5ac0d5f12..29ded7b8a 100644 --- a/server/core/src/main/java/dev/slimevr/skeleton/computedprocessors/velocity.kt +++ b/server/core/src/main/java/dev/slimevr/skeleton/computedprocessors/velocity.kt @@ -61,11 +61,14 @@ class VelocityComputedProcessor : for ((bodyPart, bone) in mutableComputedSkeleton) { val lastVelocitySample = lastVelocities[bodyPart] - // Compute current velocity + // Compute velocity val currentBoneSample = BoneSample(bone.rotation, bone.tailPosition) - - val currentVelocity = lastVelocitySample?.boneSample?.let { computeVelocity(currentBoneSample, it, deltaTime) } ?: ZERO_VELOCITY - val smoothedVelocity = smoothVelocity(currentVelocity, lastVelocitySample?.velocity ?: ZERO_VELOCITY, deltaTime) + val smoothedVelocity = if (lastVelocitySample != null) { + val currentVelocity = computeVelocity(currentBoneSample, lastVelocitySample.boneSample, deltaTime) + smoothVelocity(currentVelocity, lastVelocitySample.velocity, deltaTime) + } else { + ZERO_VELOCITY + } mutableComputedSkeleton[bodyPart] = bone.copy(velocity = smoothedVelocity) lastVelocities[bodyPart] = VelocitySample(currentBoneSample, smoothedVelocity) diff --git a/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/filtering.kt b/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/filtering.kt index 3241858a8..b7027c816 100644 --- a/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/filtering.kt +++ b/server/core/src/main/java/dev/slimevr/skeleton/inputprocessors/filtering.kt @@ -33,7 +33,7 @@ private const val UPSAMPLING_TIME_CARRYOVER_MAX = 0.9f private const val SMOOTHING_MS_MAX = 75.0 // Prediction -private const val PREDICTION_MS_MAX = 30.0 +private const val PREDICTION_MS_MAX = 32.0 private const val PREVIOUS_PREDICTION_DECAY = 0.25f private data class BoneSample(