Fix floor level calculation

This commit is contained in:
Erimel committed 2026-11-09 17:04:30 -05:00
1 parent 7e40b54c1b
commit c64fcb1f95
1 file changed
+4 -1
@@ -72,7 +72,10 @@ fun reduce(state: SkeletonState, action: SkeletonActions): SkeletonState = when
is SkeletonActions.ResetFloorLevel -> {
val skeletonHeight = state.skeletonHeight
val headHeight = state.boneInputs[BodyPart.HEAD]?.position?.y ?: skeletonHeight
val headHeight = state.boneInputs[BodyPart.HEAD]?.let {
val headOffset = it.rotation.sandwich(it.boneOffset).y
it.position?.y?.plus(headOffset)
} ?: skeletonHeight
state.copy(floorLevel = headHeight - skeletonHeight)
}