- Home /
Question by
Humansquirrel · Mar 25, 2021 at 10:10 PM ·
c#animationanimatorbeginner
pause Animation
Hi i want to pause platform animation when player jump(Does not have any state or parameters just simple rotation animation). Here is the PlayerController script attached to player
public class PlayerController : MonoBehaviour
{
private void OnTriggerEnter(Collider other)
{
if (other.tag == "Jump" & BallJump)
{
rb.AddForce(new Vector3(0, jump, 0), ForceMode.Impulse);
// HERE I WANT PLATFORM ANIMATION TO PAUSE
}
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "Ground")
{
AudioManager.Play("BounceSound");
// HERE I WANT PLATFORM ANIMATION TO PLAY CONTINUE
}
}
}
here is my platform script which has animator and i want platform animation to pause when player collide
public class AnimPlatform : MonoBehaviour
{
public Animator Anim;
private void Start()
{
Anim = GetComponent<Animator>();
}
private void OnTriggerEnter(Collider other)
{
// HERE I WANT PLATFORM ANIMATION TO PAUSE
}
private void OnTriggerExit(Collider other)
{
// HERE I WANT PLATFORM ANIMATION TO PLAY CONTINUE
}
}
Thank You :)
Comment