Unity noob here, need help adding footstep logic
Now full disclosure here: I am not that proficient in C# so I mostly have to reuse and/or tweak freely-licensed code samples for my third-person sandbox test of sorts.
I managed to add some footstep logic to the scene by adding the following script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FootstepTrigger : MonoBehaviour {
public AudioClip impact;
public AudioSource audioSource;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter (Collider other) {
audioSource.PlayOneShot(impact, 0.7F);
Debug.Log ("Walking...");
}
}
The above script is attached to mixamorig:LeftFoot and mixamorig:RightFoot along with a box collider for each foot respectively (yup, this is another one of those lazy Mixamo characters, lol). Said colliders are set as triggers, but somehow they still interfere with movement, resulting in occasional twitching whenever my character runs. Was it because the boxes are under a ThirdPersonController with a capsule collider?
To reproduce, add Ethan from Standard Assets to the scene, then assign box collider triggers and the script to his feet.
And before you tell me to just use animation events, I am using a Mixamo character and I'm kinda' at a loss as to how or where to assign such events.