Search Unity

Question Animation can't fire a particlesystem""fire ball"

Discussion in 'Animation' started by unity_408540137, Jan 27, 2023.

  1. unity_408540137

    unity_408540137

    Joined:
    Oct 23, 2022
    Posts:
    44
    I use a charcter with the Animation"""attack"" gesture, and I make a method , and the method will be called in
    Animation"""Event""

    Every thing works fine. Animation played, and particle play()

    public class EnermyController : MonoBehaviour
    {
    public ParticleSystem particleSystem;

    void MagicAttack()-->when animation starts
    {
    particleSystem.Play();
    }

    void StopMagic()--->when animation stops
    {
    particleSystem.Stop();

    }
    }


    When I want tihs ParticleSystem"""Fire Ball"" will move forward when be played.

    I don't know how to make this work.

    particleSystem.Play();

    particleSystem.transform.Translate(Vector3.forward*5*Time.deltaTime);
    // no compilled erro, but it doesn't move


    or

    particleSystem embeded with Rigidbody

    particleSystem.Play();
    -->GetComponent<Rigidbody>().velocity = Vector3.forward*5

    The fired ball just be played(), but it doesn't move..

    I just can't figure out what the difference between moving a gameobject and a particlesystem""Fire Ball"