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"

How to use Mouse aim on 2D Top-down view

Actually i found some questions about similar topic here. there was nice answer about their problem. but it wasn't fit to my needs and i don't good at english so i couldn't modify it by my self.

i will develop my game on 2D Top down view like hotline miami, want to use mouse aim for character rotation but not on movement but i don't know how.
Press W is always go to up, S is always go to down A is always go to left, D is always go to right.
is there any solution for me?
or is there any good tutorial video on Youtube Unreal engine Channel ?
I hope this picture will help you understand

alt text

Product Version: UE 4.17
question.png (97.8 kB)
more ▼

asked Oct 03 '17 at 08:01 AM in Blueprint Scripting

avatar image

3 1 1 3

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

1 answer: sort voted first

Not sure if there is a tutorial but you can achieve it by rotating the mesh inside of the Pawn rather than the Pawn itself. This way WASD will always move the Pawn in the same direction while the player mesh is facing elsewhere.

Rotating towards mouse cursor is pretty straightforward, here is a version without tracing by channel/object. It places a plane at your character's location, traces a line from the camera towards the location projected by mouse cursor in the world coordinates. When/if the line hits the virtual plane, the mesh in the pawn is rotated towards that location:

alt text

The whole logic is in the Pawn and assumes the Pawn has its own camera.

capture.png (213.3 kB)
more ▼

answered Oct 03 '17 at 10:37 AM

avatar image

15.3k 77 26 64

(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