mirror of
https://github.com/sinbad/StevesUEHelpers.git
synced 2025-02-23 17:45:23 +00:00
Add RandRange for convenience
This commit is contained in:
parent
a350802221
commit
322edbd185
@ -136,13 +136,20 @@ public:
|
|||||||
return FRotator(PitchYaw.X, PitchYaw.Y, 0).RotateVector(FVector::UpVector);
|
return FRotator(PitchYaw.X, PitchYaw.Y, 0).RotateVector(FVector::UpVector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Random point in a box
|
||||||
FORCEINLINE FVector RandPointInBox(const FBox& Box) const
|
FORCEINLINE FVector RandPointInBox(const FBox& Box) const
|
||||||
{
|
{
|
||||||
const FVector R3 = Rand3D();
|
const FVector R3 = Rand3D();
|
||||||
return FVector(FMath::Lerp(Box.Min.X, Box.Max.X, R3.X),
|
return FVector(FMath::Lerp(Box.Min.X, Box.Max.X, R3.X),
|
||||||
FMath::Lerp(Box.Min.Y, Box.Max.Y, R3.Y),
|
FMath::Lerp(Box.Min.Y, Box.Max.Y, R3.Y),
|
||||||
FMath::Lerp(Box.Min.Z, Box.Max.Z, R3.Z));
|
FMath::Lerp(Box.Min.Z, Box.Max.Z, R3.Z));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Random value in a range (inclusive)
|
||||||
|
float RandRange(float Min, float Max) const
|
||||||
|
{
|
||||||
|
return FMath::Lerp(Min, Max, Rand());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current seed.
|
* Gets the current seed.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user