I’m working on a project in UE5 using Blueprints only, and I need help with moving my FirstPersonCharacter from any starting position to a targeted location (like a room or area), with the following
The FPC should move smoothly and not teleport.
It should avoid obstacles like walls and furniture i.e., follow the correct navigation path.
The starting location can be anywhere on the map.
The movement is triggered by clicking a UI button.
I’ve tried using SimpleMoveToLocation and spline-based movement, but the character sometimes moves directly into obstacles or doesn’t find the correct path if not already near the spline.
What is the recommended approach to achieve this kind of movement?
If anyone has a working Blueprint setup or can point me to the right nodes/workflow, I’d really appreciate it.
also i got this in my output log when i click on the ui button to move my BP_FPC to the location
LogScript: Warning: Script Msg: Attempted to access index -1 from array ‘PathPoints’ of length 0 in ‘/Script/NavigationSystem.NavigationPath’!
LogScript: Warning: Script Msg called by: BP_FirstPersonCharacter_C
I misunderstood your initial request; what I provided was a way to move to an object in line of sight. What you need is AI query abilities on your character.
For that you need an AI setup–AI controller, Navmesh (which I believe you may not have, thus your error), and Behavior Tree. Find an AI tutorial below:
Then, allow your character to be possessed by the AI controller and make it pursue/locate/investigate the point of interest or item you want it to reach. See below:
i tried using ai move to in which i believe the player gets possessed by ai controller but my BP_FirstPersonCharacter didnt move does it not work for it?
and i also have nav mesh in my scene and i tried with the spline method and was able to move from my starting location being anywhere to the targeted location but due to collisions (walls and doors) i used to get stuck
If you take a look at the AI tutorial I posted; the AIs find the player, while navigating obstacles, so I know it works. The same series goes over patrol paths (splines), which would do the same more consistently.