07-20-2016 04:50 PM
07-20-2016 06:03 PM
07-20-2016 07:24 PM
PlayFootStepAudio();with
AkSoundEngine.PostEvent ("Footsteps", gameObject);and everything works just fine.
CharacterController OVR;It is working but when I move my character, it's like my sound effect is being played a 100 times in one second.
void Start () {
OVR = GetComponent<CharacterController> ();
}
void FixedUpdate () {
if (OVR.isGrounded == true && OVR.velocity.magnitude > 2.0f) {
AkSoundEngine.PostEvent ("Footsteps", gameObject);
}
}
}
07-20-2016 08:45 PM
public class FootSteps : MonoBehaviour {
float Timer = 0.0f;
CharacterController OVR;
// Use this for initialization
void Start () {
OVR = GetComponent<CharacterController> ();
}
// Update is called once per frame
void FixedUpdate () {
if (OVR.isGrounded == true && OVR.velocity.magnitude > 2.0f) {
if (Timer > 0.3f) {
AkSoundEngine.PostEvent ("Footsteps", gameObject);
Timer = 0.0f;
}
Timer += Time.deltaTime;
}
}
}
07-21-2016 01:01 AM