Page 1 of 1
Emerald ai disables collider
Posted: Wed Aug 17, 2022 6:42 pm
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.
Re: Emerald ai disables collider
Posted: Wed Aug 17, 2022 10:09 pm
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.
Re: Emerald ai disables collider
Posted: Thu Aug 18, 2022 2:16 am
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");
}
Re: Emerald ai disables collider
Posted: Thu Aug 18, 2022 8:43 am
by Tony Li
In your UnityEvent, don't set the GameObject active (GameObject.SetActive). Instead, set the BoxCollider enabled (BoxCollider.enabled).
Re: Emerald ai disables collider
Posted: Thu Aug 18, 2022 9:24 am
by hrohibil
It worked.
Thanks Tony
Re: Emerald ai disables collider
Posted: Thu Aug 18, 2022 10:10 am
by Tony Li
Glad to help!