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.

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.

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.

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.

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.

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?

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.

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

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?

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

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.

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.

ah ok thanks lol. mega noob here

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 :slight_smile:

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)

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

Ok, see here:

I helped answer this same question yesterday :slight_smile:

awesome thats perfect. thanks lol

Hey!
So actually i am pretty new to unreal and i am trying to make a game in which one of the functionality is to repair objects, all i wanna do is as soon as i come close to the object which needs repairing, the player will press a button, a progression bar will appear and the object will change its color when the bar is full.

Do you think there is a quicker way to get that done, I have add a “SphereTraceByChannel” to my Player PB, Do you think you can tell me/show me what should i do to get the progression bar when it hits the obj

the game is in top-down