Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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 :D

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.


Product Version: Not Selected
more ▼

asked Sep 29 '14 at 07:21 AM in Blueprint Scripting

avatar image

Zac Johnson
1 1 3 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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 ;)

more ▼

answered Sep 29 '14 at 02:04 PM

avatar image

5.9k 291 86 293

avatar image Zac Johnson Sep 29 '14 at 11:32 PM

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?

avatar image Erasio Sep 30 '14 at 12:36 AM

It's not limited to that.

Check out the top-down starter set. It uses the "Simple Move to Location" node for movement ;)

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".

avatar image Zac Johnson Sep 30 '14 at 05:19 AM

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!

avatar image Zac Johnson Sep 30 '14 at 06:13 AM

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

avatar image Erasio Sep 30 '14 at 01:52 PM

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 :)

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.

avatar image Erasio Sep 30 '14 at 02:21 PM

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.

avatar image Zac Johnson Oct 01 '14 at 12:24 AM

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.

avatar image Erasio Oct 01 '14 at 01:09 AM

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.

avatar image Zac Johnson Oct 01 '14 at 02:42 AM

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.

avatar image Zac Johnson Oct 01 '14 at 03:51 AM

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.

[1]: /storage/temp/16704-untitled.png

untitled.png (661.4 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question