我是一个新的统一用户,我正在尝试制作一个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