predict/smooth before other inputprocessors

for optimization!!!
This commit is contained in:
Erimel committed 2026-09-02 21:54:03 -04:00
1 parent 30f9178fec
commit 5584ae4ffa
4 files changed
+7 -2

No files matched your search

@@ -222,6 +222,7 @@ class ComputedSkeletonBehaviour(
val boneInputs = if (targetState.pausedProcessedBoneInputs != null) {
// TODO improve pause tracking code
// and also possibly head default position (HeadPositionFallbackProcessor)
// Use already-processed paused tracking data except for the head
val headBone = targetState.boneInputs[BodyPart.HEAD]
targetState.pausedProcessedBoneInputs.mutateCopy { it[BodyPart.HEAD] = headBone?.copy(position = if (headBone.isPositionActive) headBone.position else it[BodyPart.HEAD]?.position) }
@@ -53,6 +53,8 @@ class BonePredictionInputProcessor(val settings: Settings) : SkeletonInputProces
val newVelocities = bodyPartMap<BoneVelocity>()
mutableInputSkeleton.forEachBone { bodyPart, bone ->
if (!bone.isRotationActive) return@forEachBone
val prev = velocities[bodyPart]
if (prev == null) {
newVelocities[bodyPart] = BoneVelocity(bone.rotation, Quaternion.IDENTITY, now)
@@ -41,6 +41,8 @@ class BoneSmoothingInputProcessor(val settings: Settings) : SkeletonInputProcess
val newSmoothed = bodyPartMap<Quaternion>()
mutableInputSkeleton.forEachBone { bodyPart, bone ->
if (!bone.isRotationActive) return@forEachBone
val prev = smoothed[bodyPart] ?: bone.rotation
val rotation = prev.lerpR(bone.rotation, alpha).unit()
newSmoothed[bodyPart] = rotation
@@ -190,6 +190,8 @@ class Skeleton(
ComputedSkeletonBehaviour(
hz = hz,
inputProcessors = listOf(
BonePredictionInputProcessor(settings),
BoneSmoothingInputProcessor(settings),
HeadPositionFallbackProcessor(settings),
BoneYawFallbackInputProcessor(),
BoneActiveLinkInputProcessor(),
@@ -198,8 +200,6 @@ class Skeleton(
UpperLegsRollAlignInputProcessor(settings),
BoneDirectLinkInputProcessor(),
FingerImputeInputProcessor(),
BonePredictionInputProcessor(settings),
BoneSmoothingInputProcessor(settings),
),
fkProcessors = listOf(
VelocityFkProcessor(),