New PlayerPose ScriptableObject (AnimationClip + ceiling Y-offset) and PlayerPoseController that drives poses via a PlayableGraph, overriding the Animator controller. Poses are held continuously (idle, moving, on wall/ ceiling) so cycle and sprint changes show immediately. Sprinting in any state resets to pose 0. Non-keyed bones fall back to a captured rest pose so empty/partial clips apply fully. Ceiling Y-offset is folded into the controller's single mesh-offset writer. PlayerCharacterController gains IsIdle / IsSprinting / IsOnCeiling / AnimatorOverridden accessors and SetPoseLocalYOffset; SetAnimatorRunning is guarded while a pose owns the Animator. Removed obsolete Paintman.controller. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
29 lines
1.4 KiB
C#
29 lines
1.4 KiB
C#
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// A selectable player pose: an <see cref="AnimationClip"/> held while the player is idle, plus a
|
|
/// y-offset applied to the visual model only while stuck to the ceiling (so the pose hangs at the
|
|
/// right height). The first ScriptableObject in this project.
|
|
///
|
|
/// Named PlayerPose (not Pose) to avoid shadowing the built-in UnityEngine.Pose struct, mirroring
|
|
/// why the controller is PlayerCharacterController and not just "PlayerController".
|
|
/// </summary>
|
|
[CreateAssetMenu(fileName = "NewPose", menuName = "Chameleon/Pose")]
|
|
public class PlayerPose : ScriptableObject
|
|
{
|
|
[Tooltip("Clip held while the player is idle in this pose (looped if the clip itself loops, " +
|
|
"otherwise frozen on its last frame). Authored for the paintman generic rig; clips for " +
|
|
"other hierarchies will not retarget.")]
|
|
[SerializeField] private AnimationClip clip;
|
|
|
|
[Tooltip("Local-up offset added to the visual model ONLY while stuck to the ceiling, so the pose " +
|
|
"hangs at the right height. Ignored on the ground and on walls. Meters.")]
|
|
[SerializeField] private float ceilingYOffset;
|
|
|
|
/// <summary>Idle clip for this pose (may be null).</summary>
|
|
public AnimationClip Clip => clip;
|
|
|
|
/// <summary>Local-up offset applied to the model only while on the ceiling.</summary>
|
|
public float CeilingYOffset => ceilingYOffset;
|
|
}
|