How do I trigger my animation with a box (collider) attached to a road ramp?

Please I need help in making a collision script work. I have several animations for my deer(trotting, jumping, walking, died, etc.). But I want the “deer trotting” to be activated when my car passes through a box collider I attached to road ramp. After this I want, I want to set a condition in the script which is - if the car collides with the deer, the “deer died” animation should play. Here is the script I wrote but it seems not to work, no collision detected and the deer is stagnant. I also made a new trigger animation controller with transitions but I’m still not able to get it work. Pls offer me your kind assistance .alt text

alt text

,

Sorry about that i hyperlinked the text but i guess it didn’t work.

So what you need to do is have a parameter in the Animator(See this here) and set the transitions to make the proper animation play on value change.

using UnityEngine;
using System.Collections;

public class SimplePlayer : MonoBehaviour {
    
    Animator animator;
    
    // Use this for initialization
    void Start () {
        animator = GetComponent<Animator>();
    }
    
    // Update is called once per frame
    void Update () {
        float h = Input.GetAxis("Horizontal");
        float v = Input.GetAxis("Vertical");
        bool fire = Input.GetButtonDown("Fire1");

        animator.SetFloat("Forward",v); /*see that this String will have the same name as the one in the parameter you make in the Animator component's  parameter list */
        animator.SetFloat("Strafe",h);
        animator.SetBool("Fire", fire);
    }

    void OnCollisionEnter(Collision col) {
        if (col.gameObject.CompareTag("Enemy"))
        {
            animator.SetTrigger("Die");
        }
    }
}

Hope this helps.

This is the hyperlink : Unity - Manual: Animation Parameters