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 do I get the speed at which the character is currently rotating?

I need to get the speed at which the character is currently rotating.

With that I mean the player moving the mouse left, right, up or down, how fast it is changing.

There is no Get Rotation Speed node, only a Rotation Rate node which doesn't do what I want.

Product Version: UE 4.14
Tags:
more ▼

asked Dec 12 '16 at 02:37 PM in Blueprint Scripting

avatar image

MrGoatsy
604 34 26 42

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

1 answer: sort voted first

Hi,

you can easily calculate this by yourself (I'm not aware of any BP node doing this).

Speed = distance/time. Setup a BP that subtracts current position from the last stored position (=distance), get the delta time from your last calculation and you have your speed. Don’t forget to store the current position as last position in a variable...

I’m not in front of my computer right now, but on tick should do the trick.

For the char it's almost the same. Just get the delta rotator (A current world rotation, B last rotation), break the rotator (if you need e.g. the yaw) get the delta seconds divide that stuff and you are good to go.

Hope this helps.

Cheers

Terry

more ▼

answered Dec 12 '16 at 04:33 PM

avatar image

Terry J. N.
40 1 3 9

avatar image MrGoatsy Dec 17 '16 at 02:42 PM

I am only using Blueprints, would it also be possible with that?

avatar image Pariah013 Dec 17 '16 at 10:53 PM

You can definitely do this with blueprints. Before the character turns, set the Beginning Rotation variable to that rotation, then at the end of the rotation, get the character's world rotation, and subtract the beginning rotation variable from that, and divide that result from the world delta (which is the time in the world, basically.) Basically what Terry said. But a bit more of a compressed breakdown that you can reference in blueprints.

avatar image Terry J. N. Dec 18 '16 at 10:23 AM

Yes this works in BP, I'm using it to calculate speed in my VR project. It's only an example, but it should also work for rotation and other things:

alt text

I store the last position outside the function bit it should give you the idea how it works.

(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