mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-20 00:51:20 -08:00
Use head height instead of feet to calculate floor level
This commit is contained in:
1 parent
c742e7226d
commit
99222ef951
1 file changed
+3
-3
@@ -33,8 +33,8 @@ fun reduce(state: SkeletonState, action: SkeletonActions): SkeletonState = when
|
||||
is SkeletonActions.SetPausedBoneInputs -> state.copy(pausedBoneInputs = action.pausedBoneInputs)
|
||||
|
||||
is SkeletonActions.SetFloorLevel -> {
|
||||
val leftFootHeight = state.boneInputs[BodyPart.LEFT_FOOT]?.rawPosition?.y ?: 0f
|
||||
val rightFootHeight = state.boneInputs[BodyPart.RIGHT_FOOT]?.rawPosition?.y ?: 0f
|
||||
state.copy(floorLevel = (leftFootHeight + rightFootHeight) / 2f)
|
||||
val skeletonHeight = state.skeletonHeight
|
||||
val headHeight = state.boneInputs[BodyPart.HEAD]?.rawPosition?.y ?: skeletonHeight
|
||||
state.copy(floorLevel = headHeight - skeletonHeight)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user