Skip to main content

Sphere

Base:
UBlueprintFunctionLibrary
Type:
UNSpherePickerLibrary / FNSpherePicker
Header File:
NexusPicker/Public/NSpherePickerLibrary.h

Sphere: Next Density

Provides various functions for generating points [i]nside or [o]n the surface of a sphere using different random generation strategies (deterministic, non-deterministic, seeded).

The UNSpherePickerLibrary wraps the native FNSpherePicker functionality in a Blueprint friendly manner. Should you be wanting to utilize a picker in native code it is best to directly reference FNSpherePicker directly to avoid the abstraction layer as it has a similar API.

Methods​

Next Point​

Sphere: Next Sphere: Next Projected

Generates the next point inside or on the surface of a sphere from a caller-owned FNMersenneTwister, so the same picker can participate in a larger deterministic stream without rebuilding state between calls.

static void Next(TArray<FVector>& OutLocations, FNMersenneTwister& Random, const FNSpherePickerParams& Params);

Random Point​

Sphere: Random Sphere: Random Projected

Generates a random point inside or on the surface of a sphere.

info

Uses FNRandom::GetNonDeterministic() to produce pseudo-random results.

One-Shot Point​

Sphere: One-Shot Sphere: One-Shot Projected

Generates a random point inside or on the surface of a sphere using a provided seed.

Tracked Point​

Sphere: Tracked Sphere: Tracked Projected

Generates a random point inside or on the surface of a sphere while tracking the random seed state.

Boundary Fix

As of 0.3.0, FNSpherePicker no longer emits points that fall ever-so-slightly outside the configured MaximumRadius — the previous floating-point drift on rejection-sampling has been tightened.

FNSpherePickerParams​

Base​

ParameterTypeDescriptionDefault
CountintThe number of points to generate in a single pass.1
CachedWorldTObjectPtr<UWorld>The world for line tracing and drawing.
ProjectionModeENPickerProjectionModeShould the point be projected somewhere?ENPickerProjectionMode::None
ProjectionFVectorDirection and distance for the line trace.FVector(0,0,-500.f)
CollisionChannelTEnumAsByte<ECollisionChannel>The collision channel to use for tracing.ECC_WorldStatic

Sphere​

ParameterTypeDescriptionDefault
OriginFVectorThe center point when attempting to generate new points.FVector::ZeroVector
MinimumRadiusFVector2DThe minimum radius of the circle (inner bound).0.f
MaximumRadiusFVector2DThe maximum radius of the circle (outer bound).10.f
RotationFRotatorThe rotation of the circle plane.FRotator::ZeroRotator