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"

Crosshair showing when hovering over interactable objects.

Hey. I'm trying to make a system, that will let the player interact with certain objects. The interaction itself works but i need a way to tell the player which objects he can interact with. I made it so that when the player hovers over something interactable a simple dot appears. The issue is, once this crosshair appears it never goes away. alt text

Interaction is based on linetrace inside character blueprint. alt text It works all the time, checks if it hits anything and if it does it calls a function in interaction blueprint interface.

The interface is simple, it uses only 2 functions. alt text

The switch blueprint uses this interface to toggle light visibility. alt text

And here is my HUD. alt text

Nothing I tried works :/

Product Version: UE 4.10
more ▼

asked Feb 25 '16 at 01:52 PM in Blueprint Scripting

avatar image

16 1 2 5

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

2 answers: sort voted first

Ok, i found a sollution. The thing is the "Draw Croshair?" variable inside HUD blueprint was set inside switch blueprint. But when i was looking away from it there was no way of making it switch the variable to false.

HUD stays the same i just removed the "Interaction Possible?" function from interface and switch blueprints. New character blueprint looks like this: alt text

Now the line trace checks if it hits anything and if the object hit uses the correct interface. If both of these values are true it tells my HUD to draw a crosshair.

more ▼

answered Feb 25 '16 at 05:34 PM

avatar image

16 1 2 5

avatar image Alestes Apr 17 '16 at 12:49 AM

Hello friend, I've been trying to make something like you were trying to make. I actually made a different way but it works only one interactive mesh, so i decided to follow your way. But I'm kinda confused with your blueprints. What did you change, what did you switch?

If you can show me the blueprints, functions and other stuff that would be awesome. Thanks!

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

The mechanis may seem easy, but in the background it requires some work.

Ill try to explain

First I made function where I can build it up in without filling my screen to much, PlayerLookingAtInteractiveObject alt text

I dont want to line trace to happen when the player is standing still, so the function PlayerLookingAtInteractiveObject is used in the player movement controls, like Mouse and WASD input. alt text

Then I made a new function called LineScanInteractiveObjects, which does the actual line tracing. alt text

The received results of the Linetrace are then used in a different function to DefinePlayerAction As the traced actors have their own tags, I can use these tags to see what action can be performed with that object. In my example, I only have a lightswitch alt text

In order to get the Widget to pop up and tell you that you can perform an action, I've made a Blueprint Library function that casts for a widget and then set the text variable. I've used a DataTable to store the texts in, as I'm way to lazy to hard code it. Using a DataTable, all you've to remember is the Row Name and what Text was there. alt text

So now that we have LineTraced a object, found it has a tag, displayed a widget that you can perform an action, enabled input, now we just need to handle the players input to perform the action. Which is the easiest of all.

linetrace_00.png (93.1 kB)
linetrace_00a.png (139.0 kB)
linetrace_01.png (108.9 kB)
linetrace_02.png (156.2 kB)
linetrace_04.png (236.2 kB)
more ▼

answered Jan 16 '17 at 10:17 AM

avatar image

689 20 5 50

avatar image Amsanity Jan 16 '17 at 10:20 AM

Continuation... Couldnt add more screens.

In the playerPawn alt text

The CustomEvent or Function to PerformAction can contain what ever you want the player to do. In my case I've done this alt text

You should be able to get started with this, good luck!

linetrace_03.png (78.7 kB)
linetrace_05.png (59.5 kB)
avatar image chackaloso Nov 06 '17 at 07:23 AM

Wow, thanks for posting I've been scouring the web for this explanation. Would be great to see step by step in a tutorial, however I will be giving this ago shortly.

(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