mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-12-04 07:42:31 -08:00
Fix floorclip
This commit is contained in:
1 parent
ac6b6b85a2
commit
bacf9b09c7
1 file changed
+2
-2
@@ -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
|
||||
|
||||
Reference in new issue
Block a user