Land Explorer in HomeCamp with boot loading, journal UI, and CDN publish tooling.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6,18 +6,25 @@ namespace HotUpdate.Gameplay
|
||||
public sealed class ExplorerLocomotion : MonoBehaviour
|
||||
{
|
||||
Animator _animator;
|
||||
bool _hasMotion;
|
||||
Vector3 _last;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
_animator = GetComponentInChildren<Animator>();
|
||||
if (_animator != null) _animator.applyRootMotion = false;
|
||||
if (_animator != null)
|
||||
{
|
||||
_animator.applyRootMotion = false;
|
||||
foreach (var parameter in _animator.parameters)
|
||||
if (parameter.name == "Motion" && parameter.type == AnimatorControllerParameterType.Int)
|
||||
_hasMotion = true;
|
||||
}
|
||||
_last = transform.position;
|
||||
}
|
||||
|
||||
void LateUpdate()
|
||||
{
|
||||
if (_animator == null) return;
|
||||
if (_animator == null || !_hasMotion) return;
|
||||
Vector3 delta = transform.position - _last;
|
||||
_last = transform.position;
|
||||
float speed = new Vector2(delta.x, delta.z).magnitude / Mathf.Max(Time.deltaTime, 0.0001f);
|
||||
|
||||
Reference in New Issue
Block a user