mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-12-06 08:42:32 -08:00
Fix floor level calculation
This commit is contained in:
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)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user