UKismetMathLibrary::RandomRotatorFromStream
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Creates a random rotation using a specific FRandomStream, so the same seed and call order always reproduce the same rotation.
Caveats & Gotchas
- • Like RandomRotator, the distribution is uniform over Euler angles, not uniform over the rotation group SO(3) — Pitch is sampled independently of Yaw, which biases orientations slightly toward the poles.
- • Consumes multiple draws from the stream per call (one per randomized component), so interleaving this with other FromStream calls on the same stream will shift subsequent results if you insert or remove a call.
Signature
static FRotator RandomRotatorFromStream(const FRandomStream& Stream, bool bRoll) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Stream | const FRandomStream& | The random stream to draw from. | — |
| bRoll | bool | If true, the Roll component is also randomized. If false, Roll is 0. | — |
Return Type
FRotator Example
Deterministic debris orientation C++
FRandomStream DebrisStream(ExplosionSeed);
FRotator RandRot = UKismetMathLibrary::RandomRotatorFromStream(DebrisStream, /*bRoll=*/true);
World->SpawnActor<ADebrisPiece>(SpawnLocation, RandRot); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?