Emerald ai disables collider

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
hrohibil
Posts: 368
Joined: Thu Nov 04, 2021 12:50 pm

Emerald ai disables collider

Post by hrohibil »

Hey Tony

It works on my wizard character which just has an animator component and the dialogue system trigger.

But for some reason not on my Emerald AI npc. I have a system trigger on him but emerald turns off the collider trigger. It has its own box collider . I tried adding a trigger down the chain but that did not help either.
I want to fire Of a conversation when I enters the trigger zone but nothing I do helps.
User avatar
Tony Li
Posts: 21973
Joined: Thu Jul 18, 2013 1:27 pm

Re: Emerald ai disables collider

Post by Tony Li »

Hi,

You can put a trigger collider on a child GameObject. Add a TimedEvent component. Set it t Frames > 1. Configure the OnTimeReached() event to re-enable the trigger collider. Also add a Dialogue System Trigger component set to OnTriggerEnter. Make sure to assign the main AI GameObject to the Conversation Conversant field.
hrohibil
Posts: 368
Joined: Thu Nov 04, 2021 12:50 pm

Re: Emerald ai disables collider

Post by hrohibil »

Thanks Tony.

Please see image. I did exactly as you said, I just set frames to 4. But the collider never gets turned on??




I tried added a custom script like this and that works, but i would rather use your way as I don't want an extra script??

Code: Select all

 BoxCollider bc;

    // Start is called before the first frame update
    void Start()
    {
        bc = GetComponent<BoxCollider>();
       Invoke("enableBoxCol", 4f);
    }

    // Update is called once per frame
    void Update()
    {
        



    }


    public void enableBoxCol()
    {

        bc.enabled = true;
        Debug.Log("BOX TRUE");

    }
User avatar
Tony Li
Posts: 21973
Joined: Thu Jul 18, 2013 1:27 pm

Re: Emerald ai disables collider

Post by Tony Li »

In your UnityEvent, don't set the GameObject active (GameObject.SetActive). Instead, set the BoxCollider enabled (BoxCollider.enabled).
hrohibil
Posts: 368
Joined: Thu Nov 04, 2021 12:50 pm

Re: Emerald ai disables collider

Post by hrohibil »

It worked.
Thanks Tony
User avatar
Tony Li
Posts: 21973
Joined: Thu Jul 18, 2013 1:27 pm

Re: Emerald ai disables collider

Post by Tony Li »

Glad to help!
Post Reply