Have a Look at the topdown template in the engine. It does what you’re looking for.
Player pawn move to mouse location NOT using simple move to location
I’ve been to every thread and answer page that i can find and no one seems to have an answer for this, i simply want to use my mouse location to get the player pawn or character to move to it accurately using pathfinding, the mouse location part is fine i figured that out on my own, but the simple move to location stops short my goals are as follows
- use the mouse location as the destination for the pawn to pathfind to
- move the PLAYER pawn/character to that destination root
my main goal is for a movement cost (in action points) to be used when the player moves to a destination, sort of like divinity 2
i would very much appreciate any help on this
that’s using simple move to location which doesn’t let me use the acceptance radius, also it doesn’t use pathfinding
Maybe a silly question - but you laid down a navmesh correct? I know that gives AI pathfinding for free so I am assuming it would do it for any pawn.
create a player controller and create the script below. on input (mouse press) you get a character ref (character you want to move) then do a ai move to with the destination being based on the mouse location.
next place a character in the level and make it so it doesn’t get possessed by the player. pass a reference of this character to the player controller and set the variable (this can be done easily via get player controller → cast to (insert class here)).
the result here is that the character will be possessed by a ai controller which is compatible with ai move to. AI don’t have to be the enemy or not in the players control. the character in the level is basically a empty husk or a robot with no brain of its own.
The only thing i can think of after brainstorming is using an rts controller and cast to ai to move
That’s pretty much what i ended up doing, don’t know how to end this question now but this was the solution
although now i’m having the problem of the pawn going through walls and objects
how about a aiMoveTo. If theres no need to actually posses the character then you can treat it like a god game and have every character use a ai controller. then you just have a reference to the character you want to move and use a ai move to.
basically instead of thinking of the character as the player you would think of the player controller as the player. then the controller tells a ai character what to do.