How to reference Lose Sight Radius?

Hi!

I don’t know what should I plug in to Lose Sight Radius so I could read it’s value

321440-lose-sight.jpg

Hi, you need this here

321461-annotation-2020-11-08.jpg

So you need a reference to an AISenseConfig_Sight object. No idea how to get the AISenseConfig_Sight of your AI perception component in blueprints though (there is a c++ function called “GetSenseConfig” inside the AI perception component which is not blueprint callable though), but since the AISenseConfig_Sight is apparently exposed to blueprints it would be strange to have no way to access it from the AI perception component in bluepints…

Thanks for quick reply!

I was trying to get it somehow, but as you mentioned apparently it’s not blueprint callable. So there is no way to do this via blueprints? Maybe I could expose that AI Sight config somehow?

I appreciate your help, but it seems I have to find another way of what I’m trying to do since I’m no programmer (I have no knowledge of things you’ve poited out + I have no compiler - I’m just 3D artist :D). Can I actually do that without compiler?

AFAIK you need visual studio and if you write your own C++ code, then I don’t see any way around compiling it.

And if you don’t have any prior C++ knowledge (that’s where I started when I started to learn UEs C++) but a good hang on blueprints (so that you “only” need to learn the language but not the basic concepts of how UE works at the same time), then I would guess you would need a couple of days to learn enough about UEs C++ to do what I described above. You don’'t need to actually program any new functionality, you only need to expose existing functionality to blueprints.


Otherwise, I guess I would create an actor component in blueprints, add that to the AI controller, then add a “LoseSightRadius” variable to that component and set it from the AI controller at the same time when you set the “LoseSightRadius” of the AI perception component. Then if you want to know the “LoseSightRadius”, you can get it from that actor component. That way you don’t cram up the AI controller with those variables =)

I named that actor component “AIPerceptionInfo”

just a float variable called “LoseSightRadius” there

And if you add that “AIPerceptionInfo” component to your AI controller, then you can get and set that “LoseSightRadius” from there.

I don’t see any way how to get the information you want purely in blueprints (but again, maybe I missed something). What you could do, is

(-) Create your own C++ class that inherits from “UAIPerceptionComponent” (call it something like “MyAIPerceptionComponent”)

(-) Then still in C++, inside “MyAIPerceptionComponent” you create a new function, call it somethinng like “GetSenseConfigForBP” and make it “BlueprintCallable” (so that you can call that from blueprints). Then inside “GetSenseConfigForBP” you call the “GetSenseConfig” function and just return what that outputs.

(-) At last, use “MyAIPerceptionComponent” inside your AI instead of “AIPerceptionComponent”.

(-) As bonus, make “MyAIPerceptionComponent” “Blueprintable”, so that you can inherit from it in blueprints, then create a new blueprint class that inherits from that and use it.


What you could do for purely blueprints is to create a new float variable and name it something like “LoseSightRadiusCopy” and manually set that to the same value as the “LoseSightRadius”. You could even create a whole “AISenseConfig_Sight” object and set all the values there to the same as what you set in your perception component. That would give you access to all the sight config information in blueprints but is of course not a good solution since

(A) all the information is already there

(B) you would be mixing what belongs to the AI PerceptionComponent with the AI controller (or wherever you save those variables, since apparently you can’t even inherit from the AI perception component in blueprints).

That’s simple enough! :slight_smile: Thank you!

You can also use OnTargetPerceptionUpdated and a branch node to set a Bool, such as CanSeePlayer? from true to false, and vice versa. A little more plumbing from there will allow you to get it to do what you want it to do. The event comes off of the AI Sensing Component. Not sure if you can get this from a Pawn Sensing component (I don’t think so). If you break your AI stimulus you’ll be able to access the “On Successful Sensed” return value, and very directly be able to control the flow from there.

I think the above is why you see so many people struggling with trying to make an event out of lose sight radius. There are ways to control it differently if you’re using pawn sensing.