Download

What does Combine Rotators do ?

Hello, I was doing some little research but I am still not able to figure out what does “Combine Rotators” node do. I was expecting it is simple RotatorA.Yaw + RotatorB.Yaw, RotatorA.Pitch + RotatorB.Pitch, RotatorA.Roll + RotatorB.Roll, but after checking results it is some different operation. Can you give me please some nice explanation on this node ? I saw it here http://www.youtube.com/watch?v=JH6zLAMFSi0&index=7&list=PLZlv_N0_O1ga2b_ZaJoaR5dLHOFw4-MMl and I am not sure why he includes node in his graph. Thank you :slight_smile:

they are internally quaternion, here is a snipped of code from engine source


FRotator UKismetMathLibrary::ComposeRotators(FRotator A, FRotator B)
{
    FQuat AQuat = FQuat(A);
    FQuat BQuat = FQuat(B);

    return FRotator(BQuat*AQuat);
}

Hello. In the video, the function just adds 22.5 degrees to the yaw of the player character. I guess this is because he wanted to set the range of the north, for example, to be between 336.5 and 22.5 degrees, but not between 0 and 45 degrees, without troublesome calculation. :slight_smile:

I still don’t understand this can you make it little bit more clear? He said the directions will be from 0 to 180 with sign. So where does this 336.5 come from?

Hello AbhimanyuAryan,

Imagine what would happen if we disabled the offset as shown below:

739b24fb39ababc5213e341807d47248eda376e8.png

This would be odd because, even though you faced in the direction of 359 degrees, the direction would result in North West instead of North. The direction of 359 degrees is really close to the imaginary Noth axis, which is displayed just below 0 degree as a green line.

So, the zone for North should be placed around the North axis (grey line) as shown below:

e5061e84a1cb64c6d0ae7df447a0b88fb4937c8c.png

As you should have understood by now, the offset is supposed to be 22.5 degrees as each zone has a 45 degree range and each axis needs to be located in the middle of the zone.

So, if the character faces in the direction of 359 degrees (or -1 degree), the rotation will be changed into 21.5 degrees, which, in turn, falls into Index 0 (i.e. North) of the array as it is divided by 45 degrees using the “Floor” node.

for other people ,such us A(10,20,30)、B(40,50,60),CombineRotator(A,B) .In world space.First, make A rotate 40 on the Roll.Second ,make A rotate 50 on the Pitch.Last,make A rotate 60 on the Yaw。