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"

Rotate player to movedirection

Hello,

im very new (just started today...) in UE4

Before i used Unity and have there my game working already, but i would like to recreate it in UE4 to see which i like more...

Now i have already a problem:

I have 3th person camera setup (self made not the provided one) and would like to rotate the player smoothly into the direction, in which he walks...

Example: W - player facing up S - player facing down ...

Heres a "Dev-Video" of the Unity version -> and i just want to recreate this movement https://www.youtube.com/watch?v=ysQZbwVRFDM

Hope someone can help me

Product Version: UE 4.10
Tags:
more ▼

asked Feb 18 '16 at 05:02 PM in Blueprint Scripting

avatar image

Synter Games
3 1 2

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

2 answers: sort voted first

alt text

If you use a Character as your basic Actor it automatically has a CharacterMovement Component, wich has the bool of Orient Character to Movement wich will do what you want.

more ▼

answered Feb 19 '16 at 01:06 PM

avatar image

Mopperl
273 9 6 17

avatar image Synter Games Feb 19 '16 at 04:10 PM

Thats EXACTLY what i want :D

Thank you very much!

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

Hi man , You can create a new vector. call it My_Direction. When you use the input you set up My_Direction. In the tick event you check if the char forward vector is == to your My_Direction. If they are not equal , you have to calculate in wich direction you should rotate, and make your char rotate about Rot_value. You can put Rot_value out , so you can change it at any time.

more ▼

answered Feb 19 '16 at 01:00 PM

avatar image

Est_engine
1.2k 58 12 62

avatar image Synter Games Feb 19 '16 at 01:06 PM

Thanks for the Answer,

Well im really, really new to it so i have no idea how to calculate that :D But i have seen something similar in the 3th person example, im going to try now if i get it working

If yes: You'll read from me here If no: Same as yes :D

avatar image Est_engine Feb 19 '16 at 02:09 PM

I assume that your vectors are normalized, this mean that they length is 1. If they are not, you can use the normalize node to do it.

For calculate if the two direction are similar, , Subtract the two vectors, and then pin out the Length node, if this value is < of 0.1, you are looking in that direction , otherwise not. For calculate the left or right turn. Its a bit more complicated, but like before, you can subtract the two vectors to evaluate the difference between them. You have to check the distance between 2 couple of vectors. The forward vector and the wished direction. This will give you an amount of distance but you dont know if is to right or to the left. so Check also from the Right vector , and the wished direction. So comparing the two distance you can know if is close to the right turn or the left one.

Try drawing it on paper and you will surely get it

(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