mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-12-06 08:42:32 -08:00
Mocap mode more wip
This commit is contained in:
1 parent
e50469d46b
commit
18ef835373
2 files changed
+114
-91
No files matched your search
@@ -8,9 +8,8 @@ import dev.slimevr.skeleton.ResettableSkeletonProcessor
|
||||
import dev.slimevr.skeleton.SkeletonFkProcessor
|
||||
import dev.slimevr.skeleton.centreOfMass
|
||||
import dev.slimevr.skeleton.targetprocessors.FLOOR_CALIBRATION_OFFSET
|
||||
import dev.slimevr.skeleton.targetprocessors.SKATING_ACCELERATION_THRESHOLD
|
||||
import dev.slimevr.skeleton.targetprocessors.SKATING_LOCK_ENGAGE_PERCENT
|
||||
import dev.slimevr.skeleton.targetprocessors.SKATING_VELOCITY_THRESHOLD
|
||||
import dev.slimevr.skeleton.targetprocessors.SKATING_ACCELERATION_THRESHOLD_SQ
|
||||
import dev.slimevr.skeleton.targetprocessors.SKATING_VELOCITY_THRESHOLD_SQ
|
||||
import dev.slimevr.skeleton.targetprocessors.shouldLock
|
||||
import dev.slimevr.util.MonotonicValueTimeMark
|
||||
import dev.slimevr.util.inFloatingSeconds
|
||||
@@ -24,7 +23,7 @@ import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
private const val MAX_FOOT_PERCENTAGE = 50.0f
|
||||
private const val MAX_ACCEL_UP = 2.0f
|
||||
private const val SITTING_KNEE_THRESHOLD = 1.1f
|
||||
private const val SITTING_KNEE_THRESHOLD = -0.1f
|
||||
private const val CONSTANT_ACCELERATION: Float = 2.0f
|
||||
private val WARMUP_DELAY = 160.milliseconds
|
||||
private val SITTING_THRESHOLD = 1.6.seconds
|
||||
@@ -38,18 +37,15 @@ enum class FollowSource {
|
||||
|
||||
// Returns true if the user is likely sitting
|
||||
private fun isUserSitting(fk: ComputedSkeleton): Boolean {
|
||||
// based on the waist to knee vector decide if the user is sitting or
|
||||
// standing (ie, if the user is sitting the vector will be pointing off
|
||||
// to the side for both feet)
|
||||
var leftKnee: Vector3 = fk[BodyPart.LEFT_UPPER_LEG]?.tailPosition ?: return false
|
||||
var rightKnee: Vector3 = fk[BodyPart.RIGHT_UPPER_LEG]?.tailPosition ?: return false
|
||||
val hip: Vector3 = fk[BodyPart.HIP]?.tailPosition ?: return false
|
||||
leftKnee = hip - leftKnee
|
||||
rightKnee = hip - rightKnee
|
||||
// Using the local knee positions, decide if the user is sitting or
|
||||
// standing (if the user is sitting the vector will be pointing off
|
||||
// to the side for both knees)
|
||||
val leftKnee = fk[BodyPart.LEFT_UPPER_LEG] ?: return false
|
||||
val rightKnee = fk[BodyPart.RIGHT_UPPER_LEG] ?: return false
|
||||
|
||||
// if the y component of the vectors is small then the user is probably sitting
|
||||
val sittingLeft = leftKnee.y * SITTING_KNEE_THRESHOLD < leftKnee.x + leftKnee.z
|
||||
val sittingRight = rightKnee.y * SITTING_KNEE_THRESHOLD < rightKnee.x + rightKnee.z
|
||||
val sittingLeft = leftKnee.localTailPosition.y / leftKnee.offset.len() > SITTING_KNEE_THRESHOLD
|
||||
val sittingRight = rightKnee.localTailPosition.y / rightKnee.offset.len() > SITTING_KNEE_THRESHOLD
|
||||
|
||||
return sittingLeft && sittingRight
|
||||
}
|
||||
@@ -58,7 +54,8 @@ private fun isUserSitting(fk: ComputedSkeleton): Boolean {
|
||||
private fun isFootOnGround(fk: ComputedSkeleton): Boolean {
|
||||
val leftFoot = fk[BodyPart.LEFT_FOOT] ?: return false
|
||||
val rightFoot = fk[BodyPart.RIGHT_FOOT] ?: return false
|
||||
return leftFoot.tailPosition.y <= 0f || rightFoot.tailPosition.y <= 0f
|
||||
return leftFoot.headPosition.y <= 0f || rightFoot.headPosition.y <= 0f ||
|
||||
leftFoot.tailPosition.y <= 0f || rightFoot.tailPosition.y <= 0f
|
||||
}
|
||||
|
||||
private fun getSourceToFollow(fk: ComputedSkeleton): FollowSource = if (isUserSitting(fk)) {
|
||||
@@ -87,44 +84,49 @@ object FootLocalizer {
|
||||
NONE,
|
||||
}
|
||||
|
||||
private fun isFootLocked(bone: BoneState, lastPlantedFoot: PlantedFoot) = shouldLock(
|
||||
bone.tailPosition,
|
||||
bone.tailPosition,
|
||||
bone.acceleration,
|
||||
bone.velocity,
|
||||
if (lastPlantedFoot == PlantedFoot.LEFT) SKATING_LOCK_ENGAGE_PERCENT else 1f,
|
||||
0f,
|
||||
)
|
||||
private fun whichPlantedFoot(bodyPart: BodyPart) = when (bodyPart) {
|
||||
BodyPart.LEFT_LOWER_LEG, BodyPart.LEFT_FOOT -> PlantedFoot.LEFT
|
||||
BodyPart.RIGHT_LOWER_LEG, BodyPart.RIGHT_FOOT -> PlantedFoot.RIGHT
|
||||
else -> PlantedFoot.NONE
|
||||
}
|
||||
|
||||
private fun isFootLocked(bone: BoneState, lastPlantedFoot: PlantedFoot): Boolean = shouldLock(
|
||||
bone.tailPosition,
|
||||
bone.tailPosition,
|
||||
bone.acceleration,
|
||||
bone.velocity,
|
||||
lastPlantedFoot == whichPlantedFoot(bone.bodyPart),
|
||||
)
|
||||
|
||||
/**
|
||||
* Returns the average percentage the real velocity and acceleration are of
|
||||
* the scaled thresholds for velocity and acceleration
|
||||
*/
|
||||
private fun velocityAccelRatio(bone: BoneState): Float {
|
||||
val velocityPercentage = bone.velocity.linear.lenSq() / SKATING_VELOCITY_THRESHOLD
|
||||
val accelerationPercentage = bone.acceleration.lenSq() / SKATING_ACCELERATION_THRESHOLD
|
||||
val velocityPercentage = bone.velocity.linear.lenSq() / SKATING_VELOCITY_THRESHOLD_SQ
|
||||
val accelerationPercentage = bone.acceleration.lenSq() / SKATING_ACCELERATION_THRESHOLD_SQ
|
||||
return (velocityPercentage + accelerationPercentage) / 2f
|
||||
}
|
||||
|
||||
fun getPlantedFoot(fk: ComputedSkeleton, lastPlantedFoot: PlantedFoot): PlantedFoot {
|
||||
val leftFoot = fk[BodyPart.LEFT_FOOT] ?: return PlantedFoot.NONE
|
||||
val rightFoot = fk[BodyPart.RIGHT_FOOT] ?: return PlantedFoot.NONE
|
||||
val leftLowerLeg = fk[BodyPart.LEFT_LOWER_LEG] ?: return PlantedFoot.NONE
|
||||
val rightLowerLeg = fk[BodyPart.RIGHT_LOWER_LEG] ?: return PlantedFoot.NONE
|
||||
|
||||
// If foot is locked, use that
|
||||
if (isFootLocked(leftFoot, lastPlantedFoot)) return PlantedFoot.LEFT
|
||||
if (isFootLocked(rightFoot, lastPlantedFoot)) return PlantedFoot.RIGHT
|
||||
if (isFootLocked(leftLowerLeg, lastPlantedFoot)) return PlantedFoot.LEFT
|
||||
if (isFootLocked(rightLowerLeg, lastPlantedFoot)) return PlantedFoot.RIGHT
|
||||
|
||||
// Else, use velocity and accel to pick the foot who moves the least
|
||||
val leftVelocityAccelRatio = velocityAccelRatio(leftFoot)
|
||||
val rightVelocityAccelRatio = velocityAccelRatio(rightFoot)
|
||||
val leftVelocityAccelRatio = velocityAccelRatio(leftLowerLeg)
|
||||
val rightVelocityAccelRatio = velocityAccelRatio(rightLowerLeg)
|
||||
return if (leftVelocityAccelRatio < rightVelocityAccelRatio &&
|
||||
leftVelocityAccelRatio < MAX_FOOT_PERCENTAGE &&
|
||||
leftFoot.acceleration.y < MAX_ACCEL_UP
|
||||
leftLowerLeg.acceleration.y < MAX_ACCEL_UP
|
||||
) {
|
||||
PlantedFoot.LEFT
|
||||
} else if (rightVelocityAccelRatio < leftVelocityAccelRatio &&
|
||||
rightVelocityAccelRatio < MAX_FOOT_PERCENTAGE &&
|
||||
rightFoot.acceleration.y < MAX_ACCEL_UP
|
||||
rightLowerLeg.acceleration.y < MAX_ACCEL_UP
|
||||
) {
|
||||
PlantedFoot.RIGHT
|
||||
} else {
|
||||
@@ -133,17 +135,17 @@ object FootLocalizer {
|
||||
}
|
||||
|
||||
fun getCurrentFootPosition(fk: ComputedSkeleton, plantedFoot: PlantedFoot) = when (plantedFoot) {
|
||||
PlantedFoot.LEFT -> fk[BodyPart.LEFT_FOOT]
|
||||
PlantedFoot.RIGHT -> fk[BodyPart.RIGHT_FOOT]
|
||||
PlantedFoot.LEFT -> fk[BodyPart.LEFT_FOOT]?.tailPosition
|
||||
PlantedFoot.RIGHT -> fk[BodyPart.RIGHT_FOOT]?.tailPosition
|
||||
else -> null
|
||||
}?.tailPosition ?: Vector3.ZERO
|
||||
}
|
||||
|
||||
fun computeFootTravel(currentFoot: Vector3, targetFoot: Vector3) = currentFoot - targetFoot
|
||||
fun computeFootTravel(currentFoot: Vector3, targetFoot: Vector3) = targetFoot - currentFoot
|
||||
}
|
||||
|
||||
object HipLocalizer {
|
||||
fun getAdjustedTargetHip(inputs: InputSkeleton, fk: ComputedSkeleton, targetHip: Vector3): Vector3 {
|
||||
getLowestBone(inputs, fk)?.let {
|
||||
fun getAdjustedTargetHip(targetHip: Vector3, lowestBone: BoneState?): Vector3 {
|
||||
lowestBone?.let {
|
||||
if (it.tailPosition.y < FLOOR_CALIBRATION_OFFSET) {
|
||||
return Vector3(targetHip.x, targetHip.y + (FLOOR_CALIBRATION_OFFSET - it.tailPosition.y), targetHip.z)
|
||||
}
|
||||
@@ -151,7 +153,7 @@ object HipLocalizer {
|
||||
return targetHip
|
||||
}
|
||||
|
||||
fun computeSittingTravel(hip: Vector3, targetHip: Vector3) = hip - targetHip
|
||||
fun computeSittingTravel(hip: Vector3, targetHip: Vector3) = targetHip - hip
|
||||
}
|
||||
|
||||
object COMLocalizer {
|
||||
@@ -180,7 +182,7 @@ object COMLocalizer {
|
||||
val comVelocity = (previousCOM.second - currentCOM) / ((previousCOM.first - currentTime).inFloatingSeconds)
|
||||
|
||||
// Constantly pull the skeleton down a little to account for acceleration inaccuracy
|
||||
val gravity = (comAccel.y - CONSTANT_ACCELERATION) / deltaTime.inFloatingSeconds
|
||||
val gravity = (comAccel.y - CONSTANT_ACCELERATION) * deltaTime.inFloatingSeconds
|
||||
|
||||
// Add the acceleration of gravity
|
||||
return Vector3(
|
||||
@@ -190,27 +192,32 @@ object COMLocalizer {
|
||||
)
|
||||
}
|
||||
|
||||
fun getTargetCOM(inputs: InputSkeleton, fk: ComputedSkeleton, targetCOM: Vector3, comVelocity: Vector3, deltaTime: Duration): Vector3 {
|
||||
val currentCOM = targetCOM + (comVelocity / deltaTime.inFloatingSeconds)
|
||||
fun getTargetCOM(targetCOM: Vector3, comVelocity: Vector3, deltaTime: Duration) = targetCOM + (comVelocity * deltaTime.inFloatingSeconds)
|
||||
|
||||
// Update the target COM and velocity to reflect this new distance
|
||||
getLowestBone(inputs, fk)?.let {
|
||||
fun floorAdjustTargetCOM(targetCOM: Vector3, lowestBone: BoneState?) =
|
||||
lowestBone?.let {
|
||||
if (it.tailPosition.y < FLOOR_CALIBRATION_OFFSET) {
|
||||
return Vector3(currentCOM.x, currentCOM.y + (FLOOR_CALIBRATION_OFFSET - it.tailPosition.y), currentCOM.z)
|
||||
Vector3(targetCOM.x, targetCOM.y + (FLOOR_CALIBRATION_OFFSET - it.tailPosition.y), targetCOM.z)
|
||||
}
|
||||
}
|
||||
return currentCOM
|
||||
}
|
||||
targetCOM
|
||||
} ?: targetCOM
|
||||
|
||||
fun computeCOMTravel(currentCOM: Vector3, targetCOM: Vector3) = currentCOM - targetCOM
|
||||
fun floorAdjustCOMVelocity(comVelocity: Vector3, lowestBone: BoneState?) =
|
||||
lowestBone?.let {
|
||||
if (it.tailPosition.y < FLOOR_CALIBRATION_OFFSET) {
|
||||
Vector3(comVelocity.x, 0f, comVelocity.z)
|
||||
}
|
||||
comVelocity
|
||||
} ?: comVelocity
|
||||
|
||||
fun computeCOMTravel(currentCOM: Vector3, targetCOM: Vector3) = targetCOM - currentCOM
|
||||
}
|
||||
|
||||
class LocalizerFkProcessor(val settings: Settings) :
|
||||
SkeletonFkProcessor,
|
||||
ResettableSkeletonProcessor {
|
||||
private var lastHeadPosition: Vector3? = null
|
||||
private var plantedFoot = FootLocalizer.PlantedFoot.NONE
|
||||
private var targetFoot = Vector3.ZERO
|
||||
private var lastPlantedFoot = FootLocalizer.PlantedFoot.NONE
|
||||
private var targetFoot: Vector3? = null
|
||||
|
||||
private var sittingTime = Duration.ZERO
|
||||
private var targetHip = Vector3.ZERO
|
||||
@@ -230,6 +237,8 @@ class LocalizerFkProcessor(val settings: Settings) :
|
||||
val deltaTime = now - lastProcessTime
|
||||
lastProcessTime = now
|
||||
|
||||
val lowestBone = getLowestBone(mutableInputSkeleton, fk)
|
||||
|
||||
// Only follow the hip if the user's been sitting for enough time, else follow the foot
|
||||
val followSource = getSourceToFollow(fk).let {
|
||||
if (it == FollowSource.HIP) {
|
||||
@@ -245,68 +254,76 @@ class LocalizerFkProcessor(val settings: Settings) :
|
||||
}
|
||||
}
|
||||
|
||||
// Get current foot info and update target foot if planted foot changed
|
||||
val currentPlantedFoot = FootLocalizer.getPlantedFoot(fk, lastPlantedFoot)
|
||||
val currentFoot = FootLocalizer.getCurrentFootPosition(fk, currentPlantedFoot)
|
||||
// Target planted foot changed, reset target
|
||||
if (currentPlantedFoot != lastPlantedFoot) targetFoot = null
|
||||
|
||||
// Compute comVelocity and targetCom
|
||||
val currentCom = centreOfMass(fk)
|
||||
if (followSource != FollowSource.COM) targetCOM = currentCom
|
||||
val comAccel = COMLocalizer.getTorsoAccel(mutableInputSkeleton)
|
||||
comVelocity = COMLocalizer.getCOMVelocity(currentCom, previousCOMs, comVelocity, now, comAccel, deltaTime)
|
||||
targetCOM = COMLocalizer.getTargetCOM(mutableInputSkeleton, fk, targetCOM, comVelocity, deltaTime)
|
||||
targetCOM = COMLocalizer.getTargetCOM(targetCOM, comVelocity, deltaTime)
|
||||
targetCOM = COMLocalizer.floorAdjustTargetCOM(targetCOM, lowestBone)
|
||||
comVelocity = COMLocalizer.floorAdjustCOMVelocity(comVelocity, lowestBone)
|
||||
previousCOMs.add(now to centreOfMass(fk))
|
||||
|
||||
// Get current hip position
|
||||
val currentHip = fk[BodyPart.HIP]?.tailPosition ?: Vector3.ZERO
|
||||
|
||||
val travel = when (followSource) {
|
||||
FollowSource.FOOT -> {
|
||||
// Set the hip target to the current hip
|
||||
targetHip = currentHip
|
||||
|
||||
// Get foot travel
|
||||
plantedFoot = FootLocalizer.getPlantedFoot(fk, plantedFoot)
|
||||
val footTravel = if (plantedFoot == FootLocalizer.PlantedFoot.NONE) {
|
||||
targetFoot = Vector3.ZERO
|
||||
Vector3.ZERO
|
||||
} else {
|
||||
val currentFoot = FootLocalizer.getCurrentFootPosition(fk, plantedFoot)
|
||||
val travel = FootLocalizer.computeFootTravel(currentFoot, targetFoot)
|
||||
targetFoot = currentFoot
|
||||
travel
|
||||
}
|
||||
val footTravel = currentFoot?.let { current ->
|
||||
targetFoot?.let { target ->
|
||||
FootLocalizer.computeFootTravel(current, target)
|
||||
}
|
||||
} ?: Vector3.ZERO
|
||||
|
||||
// Get COM travel
|
||||
val comTravel = COMLocalizer.computeCOMTravel(targetCOM, targetCOM)
|
||||
val comTravel= COMLocalizer.computeCOMTravel(currentCom, targetCOM)
|
||||
|
||||
// Return horizontal foot travel and vertical COM travel
|
||||
Vector3(footTravel.x, comTravel.y, footTravel.z)
|
||||
|
||||
// Vector3.ZERO // TODO
|
||||
}
|
||||
|
||||
FollowSource.COM -> {
|
||||
// Set the hip target to the current hip
|
||||
targetHip = currentHip
|
||||
// Return COM travel
|
||||
COMLocalizer.computeCOMTravel(targetCOM, targetCOM)
|
||||
|
||||
// Vector3.ZERO // TODO
|
||||
// Return COM travel
|
||||
COMLocalizer.computeCOMTravel(currentCom, targetCOM)
|
||||
Vector3.ZERO // TODO
|
||||
}
|
||||
|
||||
FollowSource.HIP -> {
|
||||
// Adjust the target hip
|
||||
targetHip = HipLocalizer.getAdjustedTargetHip(mutableInputSkeleton, fk, targetHip)
|
||||
targetHip = HipLocalizer.getAdjustedTargetHip(targetHip, lowestBone)
|
||||
|
||||
// Return the sitting travel
|
||||
HipLocalizer.computeSittingTravel(currentHip, targetHip)
|
||||
|
||||
// Vector3.ZERO // TODO
|
||||
Vector3.ZERO // TODO
|
||||
}
|
||||
}
|
||||
|
||||
val newHeadPosition = (lastHeadPosition ?: headInput.position) + travel
|
||||
// Set last foot info for next frame
|
||||
lastPlantedFoot = currentPlantedFoot
|
||||
targetFoot = currentFoot
|
||||
|
||||
// Update head position from travel
|
||||
val newHeadPosition = headInput.position + travel
|
||||
mutableInputSkeleton[BodyPart.HEAD] = headInput.copy(position = newHeadPosition)
|
||||
lastHeadPosition = newHeadPosition
|
||||
}
|
||||
|
||||
override fun reset(resetType: ResetType) {
|
||||
if (resetType == ResetType.FULL) {
|
||||
lastHeadPosition = null
|
||||
plantedFoot = FootLocalizer.PlantedFoot.NONE
|
||||
lastPlantedFoot = FootLocalizer.PlantedFoot.NONE
|
||||
targetFoot = Vector3.ZERO
|
||||
sittingTime = Duration.ZERO
|
||||
targetHip = Vector3.ZERO
|
||||
|
||||
+21
-15
@@ -15,6 +15,7 @@ import dev.slimevr.util.timeSource
|
||||
import io.github.axisangles.ktmath.Vector3
|
||||
import solarxr_protocol.datatypes.BodyPart
|
||||
import solarxr_protocol.rpc.ResetType
|
||||
import kotlin.math.floor
|
||||
|
||||
data class LockState(
|
||||
val locked: Boolean,
|
||||
@@ -28,12 +29,11 @@ const val FOOT_ACCELERATION_SENSITIVITY = 1f
|
||||
|
||||
const val SKATING_LOCK_ENGAGE_PERCENT = 1.1f
|
||||
|
||||
// All squared for performance
|
||||
const val SKATING_DISTANCE_THRESHOLD = 0.25f
|
||||
const val SKATING_LINEAR_VELOCITY_THRESHOLD = 5.76f
|
||||
const val SKATING_ANGULAR_VELOCITY_THRESHOLD = 20.25f
|
||||
const val SKATING_VELOCITY_THRESHOLD = 5.76f
|
||||
const val SKATING_ACCELERATION_THRESHOLD = 0.49f
|
||||
const val SKATING_DISTANCE_THRESHOLD_SQ = 0.25f
|
||||
const val SKATING_LINEAR_VELOCITY_THRESHOLD_SQ = 5.76f
|
||||
const val SKATING_ANGULAR_VELOCITY_THRESHOLD_SQ = 20.25f
|
||||
const val SKATING_VELOCITY_THRESHOLD_SQ = 5.76f
|
||||
const val SKATING_ACCELERATION_THRESHOLD_SQ = 0.49f
|
||||
|
||||
const val FLOOR_CALIBRATION_OFFSET = 0.0025f
|
||||
const val FLOOR_DISTANCE_THRESHOLD = 0.065f
|
||||
@@ -45,13 +45,18 @@ fun shouldLock(
|
||||
lastPosition: Vector3,
|
||||
acceleration: Vector3,
|
||||
velocity: Velocity,
|
||||
thresholdMultiplier: Float,
|
||||
floorLevel: Float,
|
||||
): Boolean = ((position - lastPosition).let { Vector3(it.x, 0f, it.z) }.lenSq() <= SKATING_DISTANCE_THRESHOLD * thresholdMultiplier) &&
|
||||
(velocity.linear.lenSq() <= SKATING_LINEAR_VELOCITY_THRESHOLD * thresholdMultiplier) &&
|
||||
(velocity.angular.lenSq() <= SKATING_ANGULAR_VELOCITY_THRESHOLD * thresholdMultiplier) &&
|
||||
(position.y - floorLevel <= FLOOR_DISTANCE_THRESHOLD * thresholdMultiplier) &&
|
||||
(acceleration.lenSq() <= SKATING_ACCELERATION_THRESHOLD * thresholdMultiplier)
|
||||
wasLocked: Boolean,
|
||||
floorLevel: Float = 0f,
|
||||
correctionStrength: Float = 1f,
|
||||
): Boolean {
|
||||
val thresholdMultiplier = (if (wasLocked) 1f else SKATING_LOCK_ENGAGE_PERCENT) * (correctionStrength * 0.5f + 0.5f)
|
||||
val floorLevel = floorLevel + FLOOR_CALIBRATION_OFFSET
|
||||
return ((position - lastPosition).let { Vector3(it.x, 0f, it.z) }.lenSq() <= SKATING_DISTANCE_THRESHOLD_SQ) &&
|
||||
(velocity.linear.lenSq() <= SKATING_LINEAR_VELOCITY_THRESHOLD_SQ * thresholdMultiplier) &&
|
||||
(velocity.angular.lenSq() <= SKATING_ANGULAR_VELOCITY_THRESHOLD_SQ * thresholdMultiplier) &&
|
||||
(position.y - floorLevel <= FLOOR_DISTANCE_THRESHOLD * thresholdMultiplier) &&
|
||||
(acceleration.lenSq() <= SKATING_ACCELERATION_THRESHOLD_SQ * thresholdMultiplier * correctionStrength)
|
||||
}
|
||||
|
||||
fun computeLockState(
|
||||
wasLocked: Boolean,
|
||||
@@ -109,8 +114,9 @@ class SkatingCorrectionTargetProcessor(val settings: Settings) :
|
||||
lastLockedPositions[bodyPart] ?: curPosition,
|
||||
curBone.acceleration,
|
||||
curBone.velocity,
|
||||
if (wasLocked) SKATING_LOCK_ENGAGE_PERCENT else 1f,
|
||||
floorLevel + FLOOR_CALIBRATION_OFFSET,
|
||||
wasLocked,
|
||||
floorLevel,
|
||||
correctionStrength,
|
||||
)
|
||||
|
||||
val activeState = computeLockState(
|
||||
|
||||
Reference in new issue
Block a user