我是一個新的統一用戶,我正在嘗試製作一個2D平臺變形器。 我可以控制我的球員,但是我的跳躍有點問題。如何在玩家碰撞地面時停止觸發動畫?
我在動畫製作中使用了觸發器,它可以工作,但是我想在玩家觸摸地面時停止動畫。
最好的辦法是保持最後一跳的幀準備,直到玩家接觸地面,然後停下來。
我有一個collider2D誰在連接到播放器與此代碼gameObjet:
void Start()
{
Audio = GetComponent<AudioSource>();
Anim = transform.parent.GetComponent<Animator>();
}
void OnTriggerEnter2D (Collider2D col)
{
if (col.gameObject.tag == "Sol" || col.gameObject.tag == "Plateforme")
{
Anim.SetTrigger("stopJump");
transform.parent.GetComponent<playerController>().isGrounded = true;
Audio.pitch = 0.7f;
Audio.volume = 0.7f;
Audio.PlayOneShot(soundGround);
}
}
我的動畫有'跳「閒置」和運行之間的過渡「stopJump」。這是正確的做法嗎? see my animator here
動畫Jump不想在結束幀之前停止。如果我禁用'有退出時間',跳轉停止太早... 觸發器'stopJump'沒有優先權...
謝謝!
更好,如果你問你的問題在https://gamedev.stackexchange.com/ – CodingYoshi