This commit is contained in:
Bob.Song
2026-03-10 16:03:38 +08:00
parent 228de2445d
commit cf2e374998
86 changed files with 478 additions and 383 deletions

View File

@@ -0,0 +1,58 @@
using System;
using RootMotion.FinalIK;
using UnityEngine;
namespace NBF
{
public class PlayerIK : PlayerMonoBehaviour
{
public enum UpdateType
{
Update = 0,
FixedUpdate = 1,
LateUpdate = 2,
Default = 3
}
public UpdateType UpdateSelected;
private LookAtIK _LookAtIK;
[SerializeField] private float transitionWeightTimeScale = 1f;
protected override void OnAwake()
{
_LookAtIK = GetComponent<LookAtIK>();
}
private void Update()
{
if (UpdateSelected == UpdateType.Update)
{
IKUpdateHandler();
}
}
private void FixedUpdate()
{
if (UpdateSelected == UpdateType.FixedUpdate)
{
IKUpdateHandler();
}
}
private void LateUpdate()
{
if (UpdateSelected == UpdateType.LateUpdate)
{
IKUpdateHandler();
}
}
private void IKUpdateHandler()
{
_LookAtIK.UpdateSolverExternal();
}
}
}