How do you trigger an object’s AnimatorController, by using a different game object to trigger that AnimatorController - I am using on mouse button down(). (an example is a keypad triggering a door animation - using the keypad object to trigger the door object). I keep getting this message (Animator is not playing an AnimatorController). I have used — otherObject.GetComponent(); and public GameObject otherObject; to reference the other object. Any help Please
It’s not clear if you’re asking an Animation question or a Physics question. Are you asking how to use triggers or how to perform a certain action on an AnimatorController?
Maybe this is just a basic scripting question.
I think it’s an animation question, but I’m not certain. The idea is to click on a certain game object in order to activate another game object’s animation, using parameter trigger. But in the console log, I keep getting the message - (Animator is not playing an AnimatorController). I have referenced the intended Animator and GameObject, but still having this error. Please help.
hey @LasJJ can you share the code or script snippet. I think i got your problem.
public class TriggerScript : MonoBehaviour {
public GameObject otherObject;
Animator anim;
private void Start()
{
anim = otherObject.GetComponent();
}
private void OnMouseDown()
{
anim.SetTrigger(“Active”);
}
}
This should reference the other game object. “Active”, is the name of the trigger from the animator of the other game object. On the inspector tab in unity, I drag and drop the other game object in the public variable.
Yes, this is nothing to do with physics at all. I don’t see how it could be confused with physics. Anyway, I’ll move your post.
Apologies