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"

Getting rotation rate of actor component?

This question is a bit hard to explain what I'm running into, so bare with me if I don't describe it correctly!

I have an actor component that executes some functions based on the rate of change of rotation. Currently, to get this rate of change, I get the actors GetComponentRotation() to get the current rotation in world space, and then the next frame, I get it again and get the difference in the pitch/roll/yaw to determine the change in degrees per frame, which I can then divide by deltaTime to get change in degrees per second.

This works decently well until pitch approaches 90/-90. The problem here is that as pitch approaches this value, the roll value in the actor component's rotation starts to rise. My gyroscope implementation then sees this as a rotation of 20-30 degrees per frame, causing unintended behavior in the component. This is troublesome, because the actor, in its own reference frame, only changed pitch by 1 degree.

I'm pretty stumped on how to resolve this issue. For my implementation, I don't actually care what the pitch/roll/yaw values are, only the components change in reference to itself since last frame. Any ideas on pushing forward with this?

Product Version: UE 4.11 Preview
more ▼

asked Mar 08 '16 at 03:29 PM in C++ Programming

avatar image

49 4 5 11

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

1 answer: sort voted first

This was finally resolved by using the component's FTransform:

         FTransform currentTransform = m_pFrameComponent->GetComponentTransform();
         FTransform deltaTransform = currentTransform.GetRelativeTransform(m_prevTransform);
         float transformPitch = deltaTransform.GetRotation().Euler().Y / deltaTime;
         float transformRoll = deltaTransform.GetRotation().Euler().X / deltaTime;
         float transformYaw = deltaTransform.GetRotation().Euler().Z / deltaTime;
         m_pitchRate = transformPitch;
         m_rollRate = transformRoll;
         m_yawRate = transformYaw;
         m_prevTransform = currentTransform;

These rates are now correct and in reference to the body-frame of the component

more ▼

answered Mar 10 '16 at 01:17 PM

avatar image

49 4 5 11

(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