using UnityEngine; using UnityEditor; public static class TestPlayerPose { public static void Sample() { var player = GameObject.Find("Player"); if (player == null) player = GameObject.Find("Capsule"); if (player == null) { Debug.LogError("Player not found"); return; } var anim = player.GetComponentInChildren(); if (anim == null) { Debug.LogError("Animator not found"); return; } Debug.Log("== PLAYER ANIMATION SAMPLING =="); Debug.Log("Speed param: " + anim.GetFloat("Speed")); Debug.Log("IsMoving param: " + anim.GetBool("IsMoving")); var stateInfo = anim.GetCurrentAnimatorStateInfo(0); Debug.Log("Current State Hash: " + stateInfo.shortNameHash + ", normalizedTime: " + stateInfo.normalizedTime); Debug.Log("Is Locomotion state: " + stateInfo.IsName("Locomotion")); var leftFoot = anim.GetBoneTransform(HumanBodyBones.LeftFoot); var rightFoot = anim.GetBoneTransform(HumanBodyBones.RightFoot); var leftHand = anim.GetBoneTransform(HumanBodyBones.LeftHand); var rightHand = anim.GetBoneTransform(HumanBodyBones.RightHand); if (leftFoot != null && rightFoot != null) { Debug.Log("LeftFoot pos: " + leftFoot.position + ", RightFoot pos: " + rightFoot.position + ", Distance Z: " + Mathf.Abs(leftFoot.position.z - rightFoot.position.z)); } else { Debug.LogWarning("LeftFoot or RightFoot bone is null! Humanoid bones not bound?"); } if (leftHand != null && rightHand != null) { Debug.Log("LeftHand pos: " + leftHand.position + ", RightHand pos: " + rightHand.position); } else { Debug.LogWarning("Hands bone is null!"); } } }