Getting AI Characters to Interact With Objects

Hey there, just wondering if anyone has any links to some tutorials regarding this. I have looked around a bit, but can’t seem to find what I’m looking for. For example: I have a chair and an AI character, and I want the ai character to see “sitting in that chair” as an option for it’s behavior. I noticed that in the Skyrim creation kit that interactable objects have a ghost image of the interaction that it can perform. I don’t need the visual representation, but I’d like to set up a master bp that registers as an interactable and it’s children can specify the correct animations and stuff to use.

Here is a link to the Skyrim reference that I mentioned:

Not sure what exactly is holding you up on this. Getting AI to “sit in a chair” as an option is no different from “simpler” things like “shoot player”, “chase player”, “roam” etc. It’s all about the logic you build for it. Do you want the AI to randomly roam and then if it roams close to a chair sit down? Well you would just set up some basic roaming logic, then have a chair with collision sphere the size you would like for this interaction to occur. Then when AI overlaps this area by chance tell it to play whatever animation you like and then script it’s movement from where it is to the chair and play a sitting animation when it reaches the chair. Or have a branch on overlap and set up other logic to let it “decide” whether it wants to sit or not.

Thanks for the reply. Just was looking to see if anyone knew of a good tutorial video as I’m more of a visual learner. What’s “holding me up” on this is that I have just started learning how to create very basic ai behaviour, and was just looking for some helpful resources to check out. I already have a sphere collision set up. I suppose it’s just now down to getting the AI to know which way to face, and where to stand while playing the animations.

Ah, got you. I learned from a bunch of sources, reading, Unreal live streams, various developers with tutorials on YouTube.

This one was pretty good. As for getting AI to face certain directions, there is a "look at rotation" node you can use. But that will just "snap" to the look at point, you would need to add extra code for it to rotate smoothly, using a LERP node can be helpful here. Where to stand can be as simple as using a "move to" and put your chair in as the target location then set the "radius" of success to be however close you would like the AI to be when it "decides" it has reached the chair. If you want more specifically to have it stand for example in front of the chair you could always add like a billboard or scene component to your chair at the exact point you want the AI to locate itself when moving to "sit down". Then use the world location of the scene or billboard as the "move to" location etc. There are many ways to go about what you are trying to do. Let me know if you have any other questions! Good luck.

Awesome! Thanks for the pointers! Broken down like that makes sense. I will probably play around with that this weekend. In the end I’d like to have a town where the npcs kind of live their lives so this an integral part of that. Thanks again!

Anytime! If you have any other questions feel free to ask, if I know, I’ll help out!