Improve proxy locomotion, tier & jump sync
Fix multiple proxy animation issues: stale graph Speed collapsing jog into walk, missing slow-walk/jog tiers, and jump takeoff/landing not playing. Key changes: - Prefer position-derived movementSpeed when animationGraphSpeed is missing/stale (ResolveLocomotionGraphSpeed) and fall back to graph Speed only when it agrees within a tolerance; sender now transmits movementSpeed when local graph read is 0 and TryReadLocalAnimationGraphSpeed falls back to SpeedSmoothed. - Introduce locomotion tiers (Walk/Jog/Run) with ComputeLocomotionTier and sync ints (iSyncWalkRun/iSyncLocomotionSpeed/iSyncJumpState) to the graph; fire corresponding tier events when starting or changing tier. - Fix proxy motion application: persist per-proxy velocity and worldDelta so the Update hook does not zero-out controller motion; use measured frame motion to drive animation when network flags are sparse. - Restore correct jump behavior: fire MT/weapon-compatible jump events for takeoff and landing (JumpUp/JumpStartFrom*/jumpLand/jumpLandTo*), clear bInJumpState on landing and remove the extra proxy-side jump hold so landings exit the jump loop. - Misc: add constants and thresholds for tier/run/walk/run-land decisions and update logs to include tier labels. Files updated: plugin/include/F4TProxyAnimationSync.h, plugin/src/F4TProxyAnimationSync.cpp, plugin/src/F4AnimationDescriptor.cpp, plugin/src/F4TProxyPuppet.cpp, plugin/src/F4TProxyActorController.cpp, plugin/src/main.cpp, and docs/dev-log.md.
This commit is contained in:
@@ -30,12 +30,35 @@ namespace F4T::ProxyAnimationSync
|
||||
inline constexpr const char* kIsSprinting = "IsSprinting";
|
||||
inline constexpr const char* kInJumpState = "bInJumpState";
|
||||
inline constexpr const char* kIsInSneak = "iIsInSneak";
|
||||
inline constexpr const char* kSyncWalkRun = "iSyncWalkRun";
|
||||
inline constexpr const char* kSyncLocomotionSpeed = "iSyncLocomotionSpeed";
|
||||
inline constexpr const char* kSyncJumpState = "iSyncJumpState";
|
||||
}
|
||||
|
||||
// Maps network movementSpeed (units/sec) to graph Speed (~0-105). Used when the sender
|
||||
// does not provide animationGraphSpeed.
|
||||
// MTLocomotionBlend_SM sub-states: Walk(0), Jog(1), Run(2). Selected by graph events
|
||||
// "Walk"/"Jog"/"Run" and mirrored in iSyncLocomotionSpeed.
|
||||
enum class LocomotionTier : std::int32_t
|
||||
{
|
||||
kWalk = 0,
|
||||
kJog = 1,
|
||||
kRun = 2,
|
||||
};
|
||||
|
||||
LocomotionTier ComputeLocomotionTier(float a_graphSpeed, bool a_isSprinting);
|
||||
|
||||
// Maps network movementSpeed (units/sec) to graph Speed. Used when animationGraphSpeed
|
||||
// is missing or unreliable.
|
||||
float MapMovementSpeedToGraphSpeed(float a_movementSpeed, bool a_isSprinting);
|
||||
|
||||
// Picks the graph Speed to drive locomotion blending. Prefers animationGraphSpeed only
|
||||
// when it is above the idle threshold; a read of 0.0 while moving is common and must
|
||||
// not override the position-derived movementSpeed (which carries slow-walk/jog tiers).
|
||||
float ResolveLocomotionGraphSpeed(
|
||||
float a_movementSpeed,
|
||||
float a_animationGraphSpeed,
|
||||
bool a_isMoving,
|
||||
bool a_isSprinting);
|
||||
|
||||
struct ProxyAppliedAnimationState
|
||||
{
|
||||
bool hasAppliedGraphState{ false };
|
||||
@@ -47,6 +70,7 @@ namespace F4T::ProxyAnimationSync
|
||||
bool lastWeaponDrawn{ false };
|
||||
float lastGraphSpeed{ 0.0F };
|
||||
float lastDirection{ 0.0F };
|
||||
std::optional<LocomotionTier> lastLocomotionTier{};
|
||||
std::chrono::steady_clock::time_point movingHoldUntil{};
|
||||
std::chrono::steady_clock::time_point jumpHoldUntil{};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user