How can I get an actor to move in the opposite direction it was moving?

Hello! I’m trying to create an area where actors are not allowed to walk without using Nav Modifier Volumes. If an actor is moving into this area, I want it to turn 180 degrees and start moving in the opposite direction. I’ve thought about it for a bit, and the best way I can think of is to somehow get a vector position slightly behind the actor and tell it to move there. What is a good way to do this?

Alternatively, is there a way to get the direction an actor is facing?

Hey there @Comicbook23! So you can get an actors forward vector like this, you can just go negate it to point backwards.

UnrealEditor_2022-09-20_03-16-49

Basically you’ve got a couple of options. You could disable the player movement, AI brain them for a second and have them path backwards. You could force the players controls to input only the opposite direction when overlapping your “turn around” volume. You could even just rotate them then force input to walk forward (this is prone to error so not the best idea).

3 Likes

Thank you so much @SupportiveEntity! This worked! I got the actor to move to a point a short distance behind itself when it enters the prohibited area.

1 Like