What does 'roll' mean in the Random Rotator?

When I create a random rotator, I can select ‘roll’ as boolean. What does this do?
In the documentation it says: “with optional random roll”, which, as usual in the documentation, explains absolutely nothing…

Can someone explain what this ‘random roll’ option does?

And please put more people on the documentation of Unreal Engine. 9 out of 10 times, I find the description of blueprint nodes and C++ functions extremely general, with a complete lack of technical details, making it useless and frustrating…

I would guess it’s the same as in other rotations, i.e. rotation on the X axis, but I tested it and I couldn’t see any difference, so who knows

I like to remember it this way:

Just like you have X, Y, Z, you have Roll, Pitch Yaw (RPY) which is very close to RPG.

Roll rotates around the x axis, Pitch around the Y axis and Yaw around the Z axis.

Roll is the first letter in the RPY acronym so it’s going to rotate along the X axis :wink:

But what does it have to do with the random rotator? Without this option it will generate a random rotation without rotating around the x-axis? What’s the difference? Why is the x-axis singled out, instead of having an option for all three axes??? Must be something to it?

Well my guess is what you said about the x axis not being considered for the rotation, but why don’t you just try it!!! Wouldn’t that be easier?..

Well first, this is clearly a lack in documentation: “you can try it out for yourself” is not a good solution to that. Second: if I rotate a object somewhat randomly over y, and then over z, the resulting rotation usually does not have a 0 on the x-axis, so you can’t really try this out, because it’s random and subsequent rotations over y and z does not result in a 0 in the x-component of the rotations…

From the source:

FRotator UKismetMathLibrary::RandomRotator(bool bRoll)
{
	FRotator RRot;
	RRot.Yaw = FMath::FRand() * 360.f;
	RRot.Pitch = FMath::FRand() * 360.f;

	if (bRoll)
	{
		RRot.Roll = FMath::FRand() * 360.f;
	}
	else
	{
		RRot.Roll = 0;
	}
	return RRot;
}

seems like taking a random pitch and yaw is enough to get a random rotator, but you can opt to do an extra randomness on the roll. In this case it’s really confusing that they use the X instead of Roll here (since in x,y,z x is the first, while it’s last in pitch, yaw, and roll). Also I still don’t know what having a random roll adds to the already random rotator.

1 Like
  1. You will not find the answer to every single question you have about UE4. I agree that it’s something that should have been better explained in the Docs, but sometimes, it just isn’t, for instance: i was having issues with a multigate and all the flags and how they worked together (and they didn’t really explained it that much in the Docs), so i just tried out for myself. That’s what you should do. Don’t let a lack of documentation stop you from achieving something :wink:

  2. What object are you trying it with? If you try it with a cube the rotation might not be as noticeable. Also try printing the x rotation in both cases with the flag set to both true and false.

Can’t really help you with much more than that.

Like I said, this is not something that I could just try, because a random rotation is random, every time you use it is gives a different rotation, which looks completely random. So I can’t find the differences between setting roll on and off myself, that’s why I asked.

I don’t think it’s too much to ask for documentation on a commercial engine that at least gives some basic explanation of parameters of functions (or nodes), instead of just basically repeating the name of the parameter (“with optional random roll” ← yeah thanks documentation, for explaining that a boolean is a optional thing, and that it enables or disables ‘roll’, which is by accident also the name of the parameter )

I think it would be helpful if more people would ask for better documentation, because that’s what is needed… and if everyone just accepts lousy documentation, then it will never be improved.

Imagine you change the rotation of a bullet with a Random Rotator:

  • Pitch - rotate pointing up or down
  • Yaw - rotate pointing left or right

If that’s enough, you can leave “Roll” as False - unchecked.

If you set “Roll” as True - checked:

  • Roll - rotate the spin of the bullet

Remember, in this example, the velocity (speed & direction) will remain unchanged, regardless of the rotation.

I feel you about the documentation. Definitely helps if you can locate and understand source code, as BramV gave. Could be worse-- some Engines don’t publish source code.