UKismetMathLibrary::RandomUnitVectorInEllipticalConeInDegreesFromStream
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns a random unit vector within an elliptical cone around ConeDir, drawn from a specific FRandomStream. This is a degrees-based inline convenience wrapper around RandomUnitVectorInEllipticalConeInRadiansFromStream.
Caveats & Gotchas
- • Defined inline in the header as a thin wrapper that converts both angles to radians and forwards to RandomUnitVectorInEllipticalConeInRadiansFromStream.
- • As with the radians version, MaxYawInDegrees and MaxPitchInDegrees are independent — swapping them silently rotates the ellipse's long axis by 90 degrees rather than erroring.
Signature
static FVector RandomUnitVectorInEllipticalConeInDegreesFromStream(const FRandomStream& Stream, const FVector& ConeDir, float MaxYawInDegrees, float MaxPitchInDegrees) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Stream | const FRandomStream& | The random stream from which to obtain the vector. | — |
| ConeDir | const FVector& | The base center direction of the cone. | — |
| MaxYawInDegrees | float | The yaw angle of the cone, from ConeDir to its horizontal edge, in degrees. | — |
| MaxPitchInDegrees | float | The pitch angle of the cone, from ConeDir to its vertical edge, in degrees. | — |
Return Type
FVector Example
Deterministic weapon cone using degrees C++
FRandomStream SprayStream(WeaponSeed);
FVector Dir = UKismetMathLibrary::RandomUnitVectorInEllipticalConeInDegreesFromStream(SprayStream, AimDirection, 8.f, 2.f); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?