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"

How do i get a character to interact with an object?

I'm trying to get a character to interact with a specific object by clicking on it and it causing a reaction. I found a tutorials to start out getting characters to interact in general and it had me draw up this blueprint. alt text

I set the draw debug type so i could see if the lines were working whenever i ran it but it doesn't show any lines tracing back to my character when i click. A small side note i did compile this the screen shot was just taken before hand after trying this on a fresh template which also didn't work. What I'm trying to do in the long run is i have a bookcase set up that when the player clicks a certain book it moves the bookcase to reveal a secret passage. Both the book and the book case are static meshes idk if that matters.

Product Version: UE 4.8
sample.png (294.7 kB)
more ▼

asked Aug 14 '15 at 08:47 PM in Blueprint Scripting

avatar image

33 7 10 11

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

2 answers: sort voted first

Do it as per my screenshot below.


You weren't far off.

I understand the reason for doing it this way, its because you can point at the object you want to interact with, instead of overlapping and triggering every object on the shelf. basically, you did a +0 on the forward vector, instead of a X (insert range here) In my example below, it only picks up objects within 2 meters.

guy.jpg (144.1 kB)
more ▼

answered Aug 15 '15 at 07:29 AM

avatar image

986 34 3 41

avatar image dsmccurdy92 Aug 15 '15 at 11:17 PM

I have everything set up exactly as you do but being a noob idk what comes after the branch node and im assuming a break hit result node. Im not to familiar with blueprinting just yet. Also do i need to set the draw debug type in order to see the lines when its done?

avatar image MrGrr Aug 16 '15 at 02:19 AM

alt text

yup, i set it to persistent for testing, all the other options are a bit too short.

guy.jpg (128.9 kB)
avatar image dsmccurdy92 Aug 18 '15 at 02:49 AM

ummm maybe im just being dumb but i cant find a cast to doortest i have everything but. im running 4.8 is that what your using?

avatar image MrGrr Aug 18 '15 at 08:03 AM

yeah, i'm on 4.8.3, doortest is my door blueprint that i cast to.... the important part is you would cast to "insert YOUR blueprint name here" same with the OPEN boolean, thats why i'm casting to it in this way. i can tell exactly that object(result of the line trace) to toggle the Bool open on that object to true/false, on event tick in the door blueprint, i do door opening stuff based on that Boolean.

avatar image dsmccurdy92 Aug 19 '15 at 02:04 AM

haha wow i had no idea what i was getting into here. maybe i should study up on blueprinting a little bit lol. so just for the sake of pushing through here. say the object i want to interact with is a static mesh book on a static mess book shelf. How would i set that up. Sorry if this turned out more of a hassle than you expected lol.

avatar image MrGrr Aug 19 '15 at 04:37 AM

Dont worry, theres always something new to learn.

I'd do it the exact same way. as if you cast to your book blueprint it will only affect the book, regardless of where its placed. unless you mean as a component of the bookshelf, then we need to look at a completely different method :)

In the way i have described above if would work like Oblivion/Skyrim where you can point at a specific book on the shelf, with each book being its own unique object(in theory you could pickup and move each around independant of the shelf etc)

avatar image dsmccurdy92 Aug 19 '15 at 03:57 PM

thanks for actually being willing to work with me lol most people would just get irritated im a noob and stop trying haha. i guess to an extent i want it to be more of a component. its a book shelf that opens a secret passage way where like the player would find a clue to go look at a certain book and when they hit the button to interact with that book (which is where the preciseness comes in because it has to be that book and not any of the others on the shelf) it slides the bookcase sideways to open the secret passage. again sorry if this is a huge pain

avatar image MrGrr Aug 20 '15 at 03:49 AM
avatar image dsmccurdy92 Aug 20 '15 at 03:57 AM

awesome thats perfect. thanks lol

avatar image ambhar Aug 18 '15 at 06:23 AM

@dsmccurdy92 Doortest is a custom Blueprint,you may not have created it in your project.

avatar image dsmccurdy92 Aug 19 '15 at 02:05 AM

ah ok thanks lol. mega noob here

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

Seems like a complicated way to do it.

You should handle the interaction with the books inside your Book actor.

Put a box/sphere collision around the book, when the player StartOverlap this collision, Enable Input on the actor. Then you can handle your OnClick Event on the mesh (not the collision). Finally when the player EndOverlap the collision, Disable Input on the actor.

I've never really worked with Clicks so you might need to make sure clicks are enabled in your PlayerController.

more ▼

answered Aug 15 '15 at 06:14 AM

avatar image

51 2 4 7

avatar image MrGrr Aug 15 '15 at 07:33 AM

Its not that complicated, and to enable onclick you have to show the mouse cursor, and that messes with character control while its active.... unless thats what you want, like for a menu etc.

avatar image dsmccurdy92 Aug 15 '15 at 11:20 PM

This would probably work for what i need but i am trying to get it a little bit more precise and i geuss mouse control makes it goofy lol. Thank you for the quick response though.

(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