Interaction with AI

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
HezoMelo
Posts: 15
Joined: Mon Dec 21, 2020 5:18 pm

Interaction with AI

Post by HezoMelo »

Hey,
I am trying to set up interaction with an AI, where once the character collides with a game object a certain action will be performed. I have set up a game object with a on collision enter dialogue system trigger and ticked is trigger for both my AI and the game object but when I press play and both objects collide the character just continues to walk into the object not triggering any interaction. is there a way to set something like this up or is this impossible? I am also using opsives UCC and behavior designer on my AI character with all integrations installed btw if that is notable.
User avatar
Tony Li
Posts: 21984
Joined: Thu Jul 18, 2013 1:27 pm

Re: Interaction with AI

Post by Tony Li »

Hi,

Only one GameObject's collider should have 'Is Trigger' ticked. Try ticking 'Is Trigger' on the interactable GameObject's collider, and leave 'Is Trigger' UNticked on the AI's collider. Also add a Rigidbody to the interactable, and set it to Kinematic.

Make sure the layers are set up to register collisions. Check the layers on both GameObjects and the matrix in Edit > Project Settings > Physics.

Then check your Dialogue System Trigger's Conditions. You may want to set or clear the Accepted Tags or Accepted GameObjects sections.
HezoMelo
Posts: 15
Joined: Mon Dec 21, 2020 5:18 pm

Re: Interaction with AI

Post by HezoMelo »

Hey, I tried everything you stated to no avail.
As you see I have set up all the components to your specifications and unlike the disappearing once touching the door as specified in the dialogue system trigger game object, the character just derpily walks into the door. any idea why this may be?
User avatar
Tony Li
Posts: 21984
Joined: Thu Jul 18, 2013 1:27 pm

Re: Interaction with AI

Post by Tony Li »

Hi,

Sorry, I misread and thought you were setting the Dialogue System Trigger to On Trigger Enter. If it's set to On Collision Enter, then Is Trigger should not be ticked on the colliders of the Door or Brute.

Also - unrelated to this question - if you're using the UCC integration and want to use UCC's interaction system to allow the player to interact with things such as doors and NPCs, then you can remove the NPC's Usable component. Use an Interactable (which the Brute already has) and Dialogue System Trigger Interactable component. On the player, you can remove the Selector or Proximity Selector, and add an Interact ability like in the integration's example scene.
HezoMelo
Posts: 15
Joined: Mon Dec 21, 2020 5:18 pm

Re: Interaction with AI

Post by HezoMelo »

I apologize for the breakdown in communication, I unticked the is trigger box on both objects only to have the same results. is there any way to get this working? I am trying to set it up to where once the NPC collides with the door object he disappears and an audio clip plays. even when removing the usable component and using just the interactable component with no change in outcome.
User avatar
Tony Li
Posts: 21984
Joined: Thu Jul 18, 2013 1:27 pm

Re: Interaction with AI

Post by Tony Li »

Does the Brute have the collider, or is the collider on a child GameObject?

The Dialogue System Trigger in your setup is doing nothing more than listening for the standard Unity OnCollisionEnter message.

One other thing I can think of: Click here and check if there are any conditions that would prevent the GameObject from being set inactive:

setGameObjectConditions.png
setGameObjectConditions.png (34.68 KiB) Viewed 382 times

If that doesn't help, can you send a reproduction project to tony (at) pixelcrushers.com?
HezoMelo
Posts: 15
Joined: Mon Dec 21, 2020 5:18 pm

Re: Interaction with AI

Post by HezoMelo »

Never mind I was able to set this up using the on trigger enter trigger. thank you.
User avatar
Tony Li
Posts: 21984
Joined: Thu Jul 18, 2013 1:27 pm

Re: Interaction with AI

Post by Tony Li »

Glad you got it working! :-)
Post Reply