First person click object walk to target

I was wondering if there was a way to implement clicking on a static mesh or even a volume and making my character (in first person) walk to a target or mesh.

I am making a first person click to move horror game set in my house in the woods :smiley:

I want the navigation to be so that points of interest will highlight on mouseover and if you click on them the character/camera will “walk” to that location.

I know how to set actor location and rotation on click event but it just teleports me there.

I can do it by triggering a matinee but I think it looks a bit strange (and over complicated).

Any advice will be very very appreciated as I have been stuck on this for a long time.

Thanks!

You can use interp functions (so for location vinterp because you want to interpolate a vector).

There you can set the speed in which it should change the variables and it will slowly get you there.

That said I would suggest using a navmesh and “Simple walk to” as this will already come with pathfinding, movement and all that good stuff :wink:

Thankyou very much for the response! I will try that when I get home.
I’m new ue4 and wasn’t even aware of a navmesh yet hehe.
Although I did try the “simple walk to…” but it wouldn’t accept my player pawn or player character or payer controller inputs, I thought simple walk to was just for AI pawns?

It’s not limited to that.

Check out the top-down starter set. It uses the “Simple Move to Location” node for movement :wink:

The input is the “player controller”. Just put a “reference to self” in as controller inside of your player controller and remember that it will only work in areas which have a navmesh. If you place a “RecastNavMesh” inside of your level you can make the navigation area visible by pressing “P”.

I still cant get any of those to work (using the navmesh and building the same input as the top down mode) and have tried many variables. Is it because I don’t have “a character”? Well technically my character is “Player” which I set up with just mouse yaw and pitch axis movements (to look around) as I have used game mode override. Also with the navmesh, should I be seeing green bounds on my floor during editing (doing all this in a house with floors made from box brush).
I have been able to get my player to move around using matinee and then setting actor location with the target as Get Player Pawn and then a set rotation node with target as Get Player Controller, with the goal connected to a static mesh set to invisible during play… where-ever i set the mesh and how I rotate it is how the player will arrive.
But I really want the character to walk there like you said with pathfinding… will it not work if I don’t actually have a running physical model as my character?
Also can I use the simple move to location node in the level blueprint like I did with the matinee and set actor location to move my character to a location defined by an object initiated by a click event such as clicking on an object of interest.
My goal is to basically have points of interest and clicking on them will walk the player there.
Simple really I’m sure but I’m quite stuck hehe. REALLY hope you can help me out and thanks for pointing me in the right direction already, feels so close but just missing something.
Thanks!

I was wondering if you could also please tell me what should be put into delta time and interp speed when using the vinterp node. cheers

You don’t need a real character model. You have something with a location in your world. That’s all you need.

I’ll take a look at it later today and see how I got it working :slight_smile:

And the interp functions take “delta time”, a variable which you get from event tick or from “get delta time” and basically is the time in seconds since the last tick and interp speed which is how fast it should go from location to target. Play a bit around with this one but the correct number should be around 1-10.

Alright stupid me. You need to select “AI Controller” as AI Controller class for your character. Just a very basic class and you can write your own if you see the need eventually but it totally works with the standard one selected.

It is still using the player controller for input and everything but if AI stuff happens (i.e. pathfinding) it falls back to that one.

I got ‘set actor location with vinterp to’ to work in the player controller, but it means i need to hold down the mouse button. still cant get the simple move to location to work and the ai controller is set to ai controller.

the blueprint i had in the level blueprint to click on an object and move to taht object is almost working with the vinterp to, i have set it up the same way basically as the blueprint in player controller except that it seems to read the event tick and speed differently… instead of moving smoothly accross it just jumps in increments and the increments will be farther or shjorter depending on what ‘speed’ it is set to.

Have you set “delta time” to delta time and how far apart are the increments and how many FPS do you have?

And is your character extending “actor”, “pawn” or “character”?

Because simple move to only works with characters.

ok the move to object has been solved, I put a gate inbetween event tick set actor location, and put the on event click for object at the gate toggle node.
I still can’t get the simple move to location to work but I pretty much got it to where I want for now… although the way I have it there is no navigation, the character will just move through objects… and the pawn doesn’t “run”.
The set actor location way I wont be able to set-up walking sound either it seems… and I would really like a camera-bob.

My fps if it’s still relevent is about 80.

And I’m pretty sure my “player” extension is character as it says parent class character… is that right?

Just want you to know your help has been much appreciated, and I hope this thread will be of help to others in the future too.

I will attach what I have so far.
Do you know if there is a way to make the camera bob up and down?
I have a sound queue now so all I need is that and probably atleast for the time being that might be enough.