How do Targets work in Blueprints?
I have been browsing this site trying to find some really basic overview on how targets work in Unreal Engine blueprints and haven't found anything. All I need to know is how it works, nothing fancy nothing complicated. How do you add a reference to an object within the scene as a target, etc.
asked Aug 31 '17 at 06:19 PM in Blueprint Scripting
You are looking to find information on how to click on an object and get that object to be referenced as your 'current target'?
Basically, you would first create a blueprint that knows where your mouse/cursor location is in relation to the screen. If it's a FPS and locked in the center, it would work the same. Then, add some type of blueprint that would know what is 'under' your cursor (set some kind of variable depending on the game). These BP's would depend on how your game works. For example, maybe you can only click on objects that are nearby. Maybe when you cast a spell, your cursor image changes (and only then does the click 'do anything').
Once you have that set up, you need to do something with the info of what you hit. So, you would have some kind of variable like 'cursor target' and if you clicked on an AI/NPC character, do X (maybe set a 'character target' variable), if you clicked on an object do Z (maybe set a 'object target' variable).
A very important thing you might want to look into is the 'cast to'. You can also find an example project with similar mouse functions to what you are looking for and just copy/tweak the BP's.
answered Aug 31 '17 at 07:11 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here