ComputeFloorLevel

This commit is contained in:
Erimel committed 2026-08-27 18:48:44 -04:00
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)