x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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: http://2.bp.blogspot.com/-DXYBAIyH820/TzKKR7zQuqI/AAAAAAAABu4/tLDFG1XEnf4/s1600/Untitled.jpg

Product Version: UE 4.18
Tags:
more ▼

asked Mar 06 '18 at 01:13 PM in Blueprint Scripting

avatar image

Gampersnaz
80 9 16 24

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Mar 06 '18 at 03:24 PM

avatar image

Nebula Games Inc
5.4k 28 9 15

avatar image Gampersnaz Mar 06 '18 at 05:46 PM

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.

avatar image Nebula Games Inc Mar 06 '18 at 09:37 PM

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

https://www.youtube.com/watch?v=l1tpeVIcaGI

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.

avatar image Gampersnaz Mar 06 '18 at 09:46 PM

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!

avatar image Nebula Games Inc Mar 06 '18 at 09:52 PM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question