Download

Interacting Objects (E) and Doors: Works For One Object Only

Hello! I’m sorry if this sound stupid, but I need someone’s help in something that might be very easy for people who learned Unreal Engine more than I do.

I’ve been following Ryan Laley’s tutorial Unreal Engine 4 Tutorial - Item Inspection Part 7 - Door & Key Example - YouTube (it’s about making interactive objects for first person view kind of game like key & door) and everything works perfect until I make several interactive objects. When I’m holding one object and press E looking on other interactive object, it disappears after pressing this button again. Is there anything I can do to fix it?

I’ve followed advices from the comments under YouTube clip, and it helped to avoid destruction of other objects, but in this case I can’t trigger the door with the object I’m holding. Can somebody help me, please?

Here’s what my FPSController blueprint looks like in its part where there’s interaction with objects:

And this is the screen of function CheckLookAt used in this blueprint:

What can I do to make interaction with pickable objects & doors work the way it should?

I can archive & upload my project to the cloud if anybody will be generous enough to take a look at it (though it might be really messy in blueprints, only starting to learn it…).

Thank you for your time in advance!

I didn’t actually read this, but the my money’s on this:

image

Thank you for your reply!

Unfortunately, it’s not working for me. Here’s the video of what’s happening. (video deleted)

Closer look at this part of the event graph:

Objects destroy themselves when I use E button while I’m still holding the other interactive object.

Is check look at called on tick?

I can’t see anything wrong here.

Maybe put your project somewhere for download ( I only have 4.26… )

It’s a bit unclear what you are asking. You want the player to carry only one object at a time and be able to open door with same button?

Yes, you’re right. (Sorry for being unclean, English isn’t my native). I’d like the player to carry only one object and being able to open a door if this object is key. Something is wrong in my BP, other objects are being self-destroyed after I’m trying to pick up’em while carrying other object.

Yeah, Check Look At is connected to tick.
This project is built with UE 4.26.2, here’s the link: {LINK REMOVED} Sorry for messy BP and Russian comments.

I’m looking…

Thank you very much for taking your time and helping.

Ok. A lot of your problems are stemming from the fact that you’ve declared the variable ‘Current held item’ as an ‘item parent object’ reference. I think you should have declared it as ‘actor object reference’.

To make this change, you need to change the variable type in the FPSController, then:

  1. Add another function to the blueprint interface:

  1. In your item parent, you can add the call:

image

  1. In your FPSController you can change this call to an interface call

This won’t help with your problem YET, but it’s a crucial step which gives you two things you really need:

  1. You can directly compare the looked at actor and the held actor without casting

  2. I -think- it’s probably what was in the tutorial ( but haven’t watched it ).

I’ll come back in a while…

In the start inspect and stop inspect, it might be an idea to chop out this code

I understand it’s supposed to stop the player moving while inspecting an item, but right now, all it’s doing is locking the interface. ( and the code does nothing if you look at it ).

In fact, with those changes, your code no longer destroys actors, which is what you wanted :slight_smile:

I’m gonna go a bit further, because I think you should be able to drop what you’re holding, if you try to pick up something else…

1 Like

To make the player automatically switch objects, you can change the FPSController code to

I don’t know how well that works with the rest of the concept…

Thank you VERY, very much, I’ve tried to do the same as you’ve described, but the results were strange.

Can I ask you to give me a simple hint, how can I stop other objects (except the door) from being highlighted and selected when CurrentHeldItem is carrying? I mean, if I’m carrying the key I need to drop it manually to take the book, but I can use it on the door. And while I’m taking the book, I can’t take the key until I’ll drop the book. I’ve tried to disable input, but it disables literally everything.

This is pretty tricky I’m afraid.

It might be time to re-watch some of the vid, because I’m only assuming everything is supposed to be an actor.

For instance, when you come to open the door, you make the comparison:

but this isn’t going to work unless they are both actors. You have to change it everywhere.


I’m going to re-open you project from scratch and see if I can get it working without changing the variable type…

1 Like

Ok, if you just keep the project the as it was, and remove the ‘disable input’ and ‘enable input’ code, it works.

The player tries to pickup the next item, but fails. Nothing is destroyed.

Sorry for the hassle…

PS: I just took a quick look at the tutorial. He does use ‘item parent’ as a type. But the door, is an actor blueprint. Hmmm…

1 Like

Wow! This easy?! I can’t believe but it’s really works quite much as I wanted to. Thank you VERY, VERY much for all the time you’ve spent and your professionalism, man. Thanks again, you’ve helped me a lot. Now I feel I can move on. (Can’t believe it was this easy)
Amazing.

No worries :slight_smile:

You might also want to check out the free horror game pack:

It has all this stuff built in. You just need to make the game.

1 Like

Thanks a lot, I’ve seen it and even added in favorite in Unreal Marketplace, but since I want to get how to do some easy things at my own, I decided to follow some tutorials to learn it instead of using easy solutions. This is way more interesting, I think. :slight_smile:
Now the only thing that bugs me is that interface keeps showing after dropping down the objects, but I think I’ll figure it out by myself, thank you very, very much again, @ClockworkOcean. You’re the best.

1 Like

I’m sorry to ask a bit of a help again, but if @ClockworkOcean or someone else could take some time to give an advice, I’d be really grateful.

I’ve managed to set up interactions, so you can’t pick up another object while you already have one picked (so another one won’t destroy itself), but in this case the interaction with door isn’t working either. How can I set up interaction with door with LineTraceBy & variable or invisible trigger with OnActorOverlap, implementing it to the blueprint I already have?

(edited) I’m sorry if someone thought I’m spamming with links to my unfinished projects. I had no idea 5hus can be forbidden. Sorry. I can send it in PM if you want to help.

Sorry for bothering. Have a nice day!

No problem.

I recall the door was working when I had a look at your project. What happened?