AI Stop movement on look

how do i make the AI stop moving instantly when looking at it? She has a deceleration delay, I wish it were instantaneous when looking at she is always stopped

Hey @ZanettiGameplay, if you’re just looking for how many devs design this, there’s usually a number of ways to accomplish this. If you wanted more specific information on a specific implementation, I’d need a bit more information on how your AI is set up, camera situation, and all that wonderful jazz!

You could cast from your camera at an angle just out of view to the monster and when it’s within a certain boundary you can disable their movement and pause animations immediately.

If you’re working with C++ you could use AActor:WasRecentlyRendered (AActor::WasRecentlyRendered | Unreal Engine Documentation) to check if she’s visible (or near the edge of visibility so she gets rendered) and then disable her movement/animations.

If you really want to go low tech you could slap a custom cone collider on your camera’s vision and just set it wide enough to where right before she’s in view it connects, then you can cast from the cam to see if she’s not through the wall or something occluding her.

Tons of different games do it differently but at the end of the day, just need to disable her movement right before you can see her and reenable it when she’s not in view.

1 Like

Thank you very much for replying… I’m new to game development, I’m just using blueprint… I configured the start and stop of the artificial intelligence in my character as in the image below

I can change this in my character pawnsensing?

i change the interval detection, for 0,01… but same times the AI move fast to all sides but stay in the same place

Alright so it looks like you’ve already got your pawn-sensing already set up and detection already going. So basically you’re trying to get her to stop a little faster right? Since it seems you’ve already got the pawn sensing component and already casting to her. Basically going to have to lower your detection interval so it’s a bit faster, maybe .1 (this will make faster movements less capable to catch her moving but poll more often (I wrote that before seeing your next post)), then widen your pawn-sensing cone a bit further than the player’s view so that it’s enough to stop her before she’s actually in view. Then I’d probably change the retrigger delay to something like… 0.5 and see how it feels.

1 Like

Good idea, I’ll try with 0.5!
I’m testing with 0.01 and for now it’s ok… but I want to avoid bugs

I understand! And this shouldn’t introduce any major bugs as long as she’s the only entity you’re doing this with for now. If you start to have multiple entities doing this at once high polling and the size of the sense could cause some performance issues, but it shouldn’t be an issue for a horror game like this. Fine tuning it will definitely be all on game feel at the end of the day. Aside from that, wow your game is looking great! Honestly spooked me watching you test her out!

1 Like

Hey ZanettiGameplay, could you help a fellow newbie developer into how you made this blueprint work?, I was able to do it but it will freeze permanently and I think I didn’t wrong, think you can add me on discord and learn more from you ?, having hard time learning alone );

Hey there @Mixedstash! Could we see the blueprints and perception shape/details? I’m sure we can sort out where the bug is.

Hello SupportiveEntiy, Sorry for the late reply, as I was busy with college assignments, Here’s what I did so far with my NPC:

At first I made the NPC Roam using a blueprint I found on youtube tutorials, and whenever I make a noise by jumping, the NPC will investigate the sound that I made and prioritize the investigation sequence, then after doing so, it will go back to roaming, and if player enter it’s AIPerception sight radius the npc will begin the chase sequence.

what I want to do is:
1- the NPC will remain idle until player enter its pawnsensing/aiperception sight radius(am not sure which is the better approach so, please provide best suggestion)
2- the NPC will begin chase until it reaches the player then perform an execute action or what ever action
3- the NPC will freeze in both movement and animation with a slight delay, in which we can see what he was moving and he stopped the moment we looked at the NPC

In other words I want to replicate this NPC:

I’ve been trying to find a solution for this for the past 1-2 weeks, my head hurts my eyeballs are red, I just can’t sleep, my brain keeps thinking and looking for a solution and I really wanna learn how to do it, problem is I am lacking a lot of knowledge, so if you can please bestow your knowledge upon me please help out a growing newbie developer.

No worries! Do you have the player pawn sensing set up like Zanetti does above?

I can set it up but, I no clue to what nodes these are, the language is problematic i’d say >_<

Ahh no worries, here’s a quick English translation of those nodes for you:

Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.

Here’s a tutorial that does it almost the same exact way:

1 Like

Sorry for the necro.

How do I stop the AI from rotating while still being looked at? As soon as I walk around the AI, it keeps snapping its view to the player. I would like to know how to make it stay completely still while observed.

Thanks in advance.

Hey there @Z3R0K0! Welcome to the community! Depending on if you’re using behavior trees or not, but you’ll have to make a boolean somewhere to stop the behavior tree execution or stop all movement node for AI moves.

1 Like