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"

Modify AIPerception Sight Range at runtime [4.7.6]

I'm trying to manipulate my AI's vision radius at game time. This could be caused by a buff, upgrade or pickup. As it stands I see a get Sight Radius but not a set. Am I missing something or is it just not available until 4.8 (or maybe later)

Product Version: UE 4.7
Tags:
more ▼

asked May 27 '15 at 05:53 PM in Blueprint Scripting

avatar image

Justin.Dooley
2.1k 104 72 163

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

3 answers: sort voted first

You can do it in C++ quite easily

     FAISenseID Id = UAISense::GetSenseID(UAISense_Sight::StaticClass());
 
     if (!Id.IsValid())
     {
         UE_LOG(LogTemp, Error, TEXT("Wrong Sense ID"));
         return;
     }

     // GetPerception() = AIController->GetPerceptionComponent()
     auto Config = GetPerception()->GetSenseConfig(Id);
 
     if (Config == nullptr)
         return;
 
     auto ConfigSight = Cast<UAISenseConfig_Sight>(Config);
 
     // Save original lose range
     float LoseRange = ConfigSight->LoseSightRadius - ConfigSight->SightRadius;
     
     ConfigSight->SightRadius = NewRange;
 
     // Apply lose range to new radius of the sight
     ConfigSight->LoseSightRadius = ConfigSight->SightRadius + LoseRange;
 
     GetPerception()->RequestStimuliListenerUpdate();


more ▼

answered Apr 17 '16 at 11:43 AM

avatar image

v.s.
347 10 12 26

avatar image dheinst Apr 23 '16 at 12:01 PM

Thanks for this code snippet, this made things quite easy to expose the functionality for blueprints!

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

It'd be nice to update the arc as well, for animations that have a creature looking around. Any chance on something like this being added as well?

more ▼

answered Aug 09 '16 at 04:59 PM

avatar image

Moon
6 1

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

It's not doable via blueprints at this point, but I'll file a feature request and try to squeeze it in for 4.9

Cheers,

--mieszko

more ▼

answered Jun 27 '15 at 02:08 PM

avatar image

MieszkoZ STAFF
7.3k 223 57 412

avatar image SaOk Aug 21 '15 at 05:54 PM

Hope to see this included too. ;) Trying to have relaxed guards moving around their fireplace camp and not see player from far. While in firefights the range need to be doubled or more.

Edit: Actually could just add own distance check. But official solution could be nice too.

avatar image Mwied Mar 09 '16 at 11:22 AM

Hi mieszko

Was this option ever add to the BP ver ?

Thanks

avatar image dheinst Apr 17 '16 at 10:03 AM

Any update on this one?

Thanks!

avatar image Soviet03 Feb 16 '17 at 09:45 PM

I too would like word on this if it's possible to do in blueprint yet. My player gets larger after a certain point and I want the AI to act accordingly since the player's 2d orthogonal camera width is x2.

PS: I don't know C++ and have been using blueprint for my simplistic 2D project. I hope that with time becoming proficient in blueprint will help me understand some of the fundamentals of coding in C++. (Before I started I didn't even know what a boolean was).

avatar image crossmr Nov 24 '18 at 02:02 PM

3 years..and 12 versions later. Got this squeezed in yet?

(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