x

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"

Have Player Follow Mouse

I have a top down game made from scratch. I need the player to always be moving towards the mouse. I tried a couple of things to no avail and I tried looking at the top down project, but I just don't understand it. I feel so dumb because I can set up normal movement with arrow keys and the likes so easily, but I can't figure this out.

Product Version: UE 4.21
Tags:
more ▼

asked Jan 23 '19 at 07:45 AM in Blueprint Scripting

avatar image

Yukomaru
7 2 1 5

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

Hi! For first, read guides and documentation. All information there.

You need this: Event Tick -> Get Hit Result Under Cursor By Channel -> Location

After that just say to your pawn with AI controller Move to Location.

And if he doesn't move, check this setting in pawn: Auto Posses Ai. Set it to Placed in the world or Spawn. alt text

screenshot-1.png (148.0 kB)
more ▼

answered Jan 23 '19 at 09:42 AM

avatar image

Shiggi
137 6 6 8

avatar image Yukomaru Jan 23 '19 at 03:42 PM

I did that exact setup and it didn't work. the player would move towards the mouse for the first second and then just go in a straight line forever. Also, I did try to find documentation on my question and even scoured youtube and could not find anything on how to do it properly.

avatar image Yukomaru Jan 23 '19 at 04:26 PM

That did work. Apparently I forgot the nav mesh and I am disappointed in myself.

(comments are locked)
10|2000 characters needed characters left

And don't forget to use NavMeshBoundsVolume on your level :)

more ▼

answered Jan 23 '19 at 09:45 AM

avatar image

Shiggi
137 6 6 8

(comments are locked)
10|2000 characters needed characters left
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