概要
Corgi Engine で「Corgi Controller」の
「Maximum Slope Angle」に設定している角度よりも急角度な坂道に乗っている時に
ジャンプできないようにしたい場合は以下のようなスクリプトを作成します
using MoreMountains.CorgiEngine; using UnityEngine; [RequireComponent( typeof( CorgiController ) )] [RequireComponent( typeof( CharacterJump ) )] public sealed class Player : MonoBehaviour { [SerializeField] private CorgiController m_corgiController; [SerializeField] private CharacterJump m_characterJump; private void Reset() { m_corgiController = GetComponent<CorgiController>(); m_characterJump = GetComponent<CharacterJump>(); } private void Update() { var maximumSlopeAngle = m_corgiController.Parameters.MaximumSlopeAngle; var belowSlopeAngle = m_corgiController.State.BelowSlopeAngle; var canJump = Mathf.Abs( belowSlopeAngle ) < maximumSlopeAngle; m_characterJump.AbilityPermitted = canJump; } }