Hello,
I am currently learning blueprints and started on a 5.6 project that includes drawers and doors. I set up two seperate blueprints following this turorial: https://www.youtube.com/watch?v=x7q4Ans3mPk
One Blueprint based on location, one based on rotation. Both blueprints seem to work individually. Whenever I save one of the blueprints, it appears to take the changes towards the other blueprint while simulating (drawers rotate, doors move).
The following Video shows the exact problem. https://youtu.be/0JmU-jeO7Mw
I also tried to create a new project but it didn’t seem to fix the issue.
The blueprints are setup like this:
One potential issue I’m seeing is you’re generically targeting static mesh components, rather than specifically targeting your doors/drawers. My advice would be to filter your hits via Hit Actor, not Hit Component. Cast Hit Actor to the relevant blueprint type, e.g. BP_Door, and if the cast fails, ignore the request.
Thanks for the clearer video of your blueprint graphs. What I understand from your setup is that when you use the input that causes the interact action, you invoke it on all actors. Then in each actor with the interact event, you do a line trace finding the static mesh component that intersects the line trace. But you don’t check that this component is part of the current actor (or that the hit actor is the current actor). So you’re affecting components that are in other actors. This means that BOTH blueprints will take effect at the same time and one of them will win out.
To fix it, check that ‘hit actor’ equals ‘Self’.
Realistically, you should do your line trace in your player character and then invoke a different and custom interact event on the actor and component directly. This is best done with an interface and you just issue a message. Pass in the hit component as an argument. Then you can remove the line trace from your drawer actors and you don’t need to compare hit actor to Self. It’s also more efficient since you don’t have a bazillion line traces going on every time you interact with something. Because right now, every time you interact with something, every single one of your actors that can be interacted with will cast a line trace. There’s no need for that.
Hope this helps.
Summary: Check hit actor == Self
Bonus optimization: Move line trace to player character and invoke different event directly on hit actor passing in the hit component. Then you don’t even need the comparison above.
edit: If you need help setting up an interface for your interactions or moving the line trace to the player character, I’ll be happy to assist.
Here’s a proper interaction system. It’s Multiplayer based but can be converted to single player easily.
The series covers interaction setup, modification, doors and elevators. This is a teaching series in 4 parts.
A more production level version uses 100% interface and gameplay tags.