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"

How to get the direction the player is walking?

So I am making a top-down shooter and the character moves independant of where he shoots.

I need to get the world direction of movement (not aiming) and rotate the character to face that direction. How would I calculate that?

Thanks.

Product Version: UE 4.21
Tags:
more ▼

asked Apr 21 '19 at 01:37 AM in Blueprint Scripting

avatar image

xGameSlave
11 3 7

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

1 answer: sort voted first

"Get Forward Vector" will tell you the direction the player/mesh is facing. Depending on how you ‘aim’ you either need the actor forward vector, or some component of the actor that is in the direction of movement. Or whatever you use to move the actor you should have the forward vector if you are directly moving the mesh. It kind of doesn’t make sense what you are asking. "Aiming" is a rotation of either a gun or the entire body of the player character. If the whole body is rotated then when you ‘move’ the character simply use ‘find look at rotation’ between the current forward vector and the movement input vector. If only the gun is rotated then the player is already facing the direction of movement and the aiming is what changes or rotates.

more ▼

answered Apr 21 '19 at 02:13 AM

avatar image

Nebula Games Inc
5k 27 9 14

(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