Hi Chris, is there an easy way to have particles appear as the player walks?
Attach a Particle System to the same object as their Animator and use Animation Events to call its Play function in their walk animations.
Does this still work if using Spine to animate the Player?
Spine has its own animation event system, details can be found here: http://en.esotericsoftware.com/spine-unity-events
Otherwise, you can read an AC character's charState to determine if they are walking:
using UnityEngine; using AC; public class ParticlesOnMove : MonoBehaviour { public AC.Char character; public float frequency = 0.5f; public ParticleSystem particles; private float timer; void Update () { if (character.charState == CharState.Move) { timer -= Time.deltaTime; if (timer <= 0f) { timer = frequency; particles.Play (); } } else { timer = frequency; } } }
Hi Chris, do I attach the above object to the Players root or whichever object has the Animator attached?
Either - the variables are taken from the Inspector.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Attach a Particle System to the same object as their Animator and use Animation Events to call its Play function in their walk animations.
Does this still work if using Spine to animate the Player?
Spine has its own animation event system, details can be found here:
http://en.esotericsoftware.com/spine-unity-events
Otherwise, you can read an AC character's charState to determine if they are walking:
Hi Chris, do I attach the above object to the Players root or whichever object has the Animator attached?
Either - the variables are taken from the Inspector.