diff --git a/server/core/src/main/java/dev/slimevr/skeleton/targetprocessors/floor-clip.kt b/server/core/src/main/java/dev/slimevr/skeleton/targetprocessors/floor-clip.kt index 0d19a583f..1cdbe5896 100644 --- a/server/core/src/main/java/dev/slimevr/skeleton/targetprocessors/floor-clip.kt +++ b/server/core/src/main/java/dev/slimevr/skeleton/targetprocessors/floor-clip.kt @@ -25,13 +25,13 @@ class FloorClipTargetProcessor( val parentTargetY = mutableIkTargets[parentPart] ?: fk[parentPart]?.tailPosition ?: continue // Offset the parent target by the lowest child as well so that none of its active children are under the floor either. - var lowestChildTargetY = parentTargetY.y + var lowestChildTargetY = 0f for ((_, childPart) in iterateBodyPartHierarchy(parentPart, true)) { if (inputSkeleton[childPart]?.isRotationActive == false) continue val target = mutableIkTargets[childPart] ?: fk[childPart]?.tailPosition ?: continue if (target.y < lowestChildTargetY) lowestChildTargetY = target.y } - val childOffset = (parentTargetY.y - lowestChildTargetY).coerceAtLeast(0f) + val childOffset = if (lowestChildTargetY < 0f) (parentTargetY.y - lowestChildTargetY).coerceAtLeast(0f) else 0f // Snap the parent up. val targetY = parentTargetY.y.coerceAtLeast(floorLevel) + childOffset