I've been stuck on this for hours.
I have a character whose animations are based in mecanim to transition based on the bool
variable ShivaEnter
. One invisible cube is set to change the bool
value from false
to true
and vice-versa OnTriggerEnter
.
The code is as follows:
using UnityEngine;
using System.Collections;
public class PontyAnimations : MonoBehaviour {
//[SerializeField]
private Animator animator;
//private GameObject ponty;
//private GameObject ponty;
void Awake () {
animator = GetComponent <Animator>();
}
void OnTriggerEnter (Collider other) {
if (other.gameObject.tag == "Player") {
animator.SetBool ("ShivaEnter", true);
}
}
void OnTriggerExit (Collider other) {
if (other.gameObject.tag == "Player") {
animator.SetBool ("ShivaEnter", false);
}
}
}
if
statement ever triggered? \$\endgroup\$ – wondra Nov 15 '15 at 20:56if (other.gameObject.tag == "Player") { ...}
(did we meant the same thing?), then the problem lies in collision detection rather than in animation. \$\endgroup\$ – wondra Nov 15 '15 at 21:02