mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-11-21 09:31:20 -08:00
ComputeFloorLevel
This commit is contained in:
1 parent
99222ef951
commit
dd2d6542d3
3 files changed
+3
-3
No files matched your search
@@ -159,7 +159,7 @@ class ResetsManager(val context: ResetsContext, val server: VRServer, val settin
|
||||
|
||||
if (resetType == ResetType.FULL) {
|
||||
// Tell the skeleton to set the floor level
|
||||
skeleton.context.dispatch(SkeletonActions.SetFloorLevel)
|
||||
skeleton.context.dispatch(SkeletonActions.ComputeFloorLevel)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ sealed interface SkeletonActions {
|
||||
data class SetProportions(val lengths: Map<SkeletonBone, Float>) : SkeletonActions
|
||||
data class PauseTracking(val pause: Boolean) : SkeletonActions
|
||||
data class SetPausedBoneInputs(val pausedBoneInputs: InputSkeleton) : SkeletonActions
|
||||
data object SetFloorLevel : SkeletonActions
|
||||
data object ComputeFloorLevel : SkeletonActions
|
||||
}
|
||||
|
||||
typealias SkeletonContext = Context<SkeletonState, SkeletonActions>
|
||||
|
||||
@@ -32,7 +32,7 @@ fun reduce(state: SkeletonState, action: SkeletonActions): SkeletonState = when
|
||||
|
||||
is SkeletonActions.SetPausedBoneInputs -> state.copy(pausedBoneInputs = action.pausedBoneInputs)
|
||||
|
||||
is SkeletonActions.SetFloorLevel -> {
|
||||
is SkeletonActions.ComputeFloorLevel -> {
|
||||
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