Trying to select AI from first person perspective

My question is simple I have an AI bot that is able to move to and follow MyCharacter which is using the first person template, I want to be able to look at the bot and on a button press select the bot and get it to move to a new location on another button press while using the behaviour tree system if possible.

Thank you
DJ26

Well you can do a line trace after some event (like a key press). The result will be a hit result which you can break to get the bot as actor. Cast it to your bot class to check if it’s one of those and if it is set this class as selected (just put it in some variable). Then when you press that button (or some other button) again (you can do that by adding a branch and checking if your variable is empty… don’t forget to clear this variable again after you told the bot where to go if you chose this method) do again a trace and this time take the hit location (no the impact location but the location) and use that to set a value in your blackboard. Inside of your bot check if that value is set to something besides your current location and if it is move there.

I hope this helps.

Cheers :slight_smile:

Thank you for the help I will give it a go and tell you how I get on

@Erasio I have managed to cast to the bot from the hit result and print a string which says “selected” but I am unsure on how to do the rest as I’m not very skilled with blueprints could you show some screenshot of what you mean in the hope it may sink in because I’m getting confused thank you

DJ26

I don’t have one. I never created this exact system but only somewhat remotely similar once.

After you select your bot save it in a variable and do a second trace for the location. Then use a blackboard to communicate with your bot (or just use a simple move to without behavior tree).

For a guide on how to set up your bt and blackboard check out this :

https://docs.unrealengine.com/latest/INT/Engine/AI/BehaviorTrees/QuickStart/index.html

Ok thank you I will refer to the docs for extra guidance thank you for your help if I keep going I will be able to get it working

Don’t hesitate to ask again. I’m happy to help or clarify everything I can.

But do formulate a concrete question please since I will not develop whole features for someone else. I’m more than happy to help though! :slight_smile:

I will do thank you for your support