On the npc I have a Box Collider Is Trigger is set to false unchecked.
I also have on the npc a Rigidbody both use gravity and is kinematic checked true.
And on the npc also attached this script :
The idea is when the npc hit a door that also have a box collider the npc will stop walking.
I have a parameter in the Animator called Walking Speed set to 1.0 and I want to set it to 0 when colliding with the door but it’s never reaching to the OnTriggerEnter in the code I use a break point.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DetectColliders : MonoBehaviour
{
private Animator animator;
private void Start()
{
animator = GetComponent<Animator>();
}
void OnTriggerEnter(Collider collider)
{
animator.SetFloat("Walking Speed", 0);
}
}