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"

How to make a simple interaction system?

How to make an interaction system were for example I click E to pick up or show an item while flouting to inspect it or E to activate an audio or E to move something or click a button to open doors you know what I mean now

Product Version: UE 4.21
Tags:
more ▼

asked Jan 15 '19 at 05:50 AM in Using UE4

avatar image

bradhrad
18 1 3 7

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

2 answers: sort voted first

ok so what we wanna do is make a blueprint inter face then go inside that rename the new function to interact then we wanna go inside the item we are interacting with and go to class setting and set the interface then in then event graph you wanna do event interact and then run your code then go to you project settings and set a new input action select the key you wanna use and then go to your character and get the input action interact and check if the item implements the interface which which class would be interact interface if it does then you wanna call its interact message see screen shots for full code hope it helps alt textalt textalt textalt textalt text

inter1.png (681.2 kB)
inter2.png (84.7 kB)
inter3.png (244.2 kB)
inter4.png (123.1 kB)
inter5.png (252.7 kB)
more ▼

answered Jan 15 '19 at 06:08 AM

avatar image

dabs863
156 1 3 6

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

What you are asking could have a lot of approaches and objectives but if you are doing a first person or third person game, what first comes to mind here is:

-On the event of pressing the E key:

-Line trace (channel):

-From: Center of the screen

-To: Forward vector of the rotation of the camera, times the reach in distance you want it to have, + camera location (someone correct this if it is wrong)

-Then check if the trace hit a grabbable object by:

-"Equal (object)" at the "hit actor" or "hit component" output of the trace as you wish (split the output struct of the trace to find this), and compare them to the actor or component you wanna know if was hit by the line. If it was a grabbable object, bingo.

-You might wanna chain some branches at the falses of other branches to check for different objects.


This is just a way to do this. Then you can do whatever and fire whatever action or event with that object found by the trace. Lemme know.

more ▼

answered Jan 15 '19 at 06:12 AM

avatar image

ErtieZone
26 3 5

(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