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"

Heading/Pitch/Roll Flipping Issue

I have an object that is being rotated in the engine. I'm sending the object's location (x,y,z) and rotations (heading, pitch, roll) to a different software.

When you manually enter in the position and rotations values, in Unreal Engine 4, the information is correctly transferred to the other software.

If you use the rotation tool to alter the object, the information passed suffers odd conversions. When physics are applied to the object the position values are correct, but the rotations show odd flipping back and forth.

How can we have the values transferred in the same manner as when you enter in the values?

Thanks for the help!

Product Version: Not Selected
Tags:
more ▼

asked Jun 30 '14 at 06:42 PM in Using UE4

avatar image

tthorpe
6 3 5 9

avatar image Ben Halliday STAFF Jun 30 '14 at 08:30 PM

Hey tthorpe,

I'd like to make sure I understand you correctly.

  • Is this occurring with a static mesh included in the engine, or is it one you imported? Or is a BSP?

  • Does odd flipping you describe occur in the editor or only in the external program you're using?

  • Which external program are you referring to?

Thanks!

avatar image tthorpe Jun 30 '14 at 10:11 PM

Thanks for your help Ben.

The object was imported from Maya as a .fbx file. The flipping occurs only in the external software, which is an internal program I am working on.

The main concern I have is that it appears that rotation is being passed differently when using Unreal for editing postions and rotations, when compared to simulating the game world and altering them with physics. Is it possible that the values being passed while simulating are using Quaternions?

The moment that I enter in 181 for the X rotation, it automatically changes it to -179.999... Do you know what is causing this? This could be a cause of the issue, but I would like to confirm.

I have included an image as well.!

ue4image.png (23.0 kB)
avatar image tthorpe Jul 03 '14 at 10:04 PM

Ben,

I have been altering rotation values, and I am unsure of what it is doing. By altering the Z-axis value to 30 Degrees causes the model's rotation to be altered, but not in the Z-axis. It alters the X-axis to be negative 30 Degrees.

I am just feeling lost on this one. Any thoughts or suggestions?

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

1 answer: sort voted first

Solution

The FRotator has odd behaviors regarding this flipping you are seeing, I encountered it earlier today, and for the past year or so. Going from 181 to -179 is actually a correct behavior, but you are indeed noticing that there's some places where the rotator goes from -180 to 180 and other places where it goes 0 to 360

sooooo

I just today made a node to standardize this FRotator flipping issue

You should always standardize the FRotator before sending it to your software and then you will be done with this issue.

Then your results will always be consistent! Standardized!

 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 //        Solution to All Those Rotator Issues
 //            Remap it to always be in -180 to 180!
 //  -Rama
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 static FORCEINLINE FRotator StandardizeRotator(const FRotator& Rotator)
 {
     return FRotator(
         (Rotator.Pitch > 180) ? Rotator.Pitch - 360 : Rotator.Pitch,
         (Rotator.Yaw > 180) ? Rotator.Yaw - 360 : Rotator.Yaw,
         (Rotator.Roll > 180) ? Rotator.Roll - 360 : Rotator.Roll
     );
 }

Summary

If you standardize all your FRotators to be in the range [-180,180] for pitch yaw and roll, then you can do reliable math calculations based on your FRotators and you wont get odd flipping behaviors

:)

Rama

more ▼

answered Jun 30 '14 at 10:16 PM

avatar image

Rama
10.7k 446 346 1090

avatar image tthorpe Jul 02 '14 at 09:56 PM

Thanks for your help Rama.

I believe the current issue I'm having is caused by the order of rotation. The other software is performing rotations by:

Yaw Pitch Roll

And apparently Unreal is performing rotations by:

Pitch Yaw Roll

Is there a built in function that can alter the order of rotation?

Thanks again for the help.

(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