public abstract class Sandbox.Clutter.Scatterer
Base class to override if you want to create custom scatterer logic. Provides utility methods for entry selection and common operations.
Related Guides
Broader workflow and conceptual references connected to this API.
Constructors
Showing 1 constructors
protected Scatterer()
No results match this filter.
Methods
Showing 7 methods
protected int CalculatePointCount(BBox bounds, float density, int maxPoints = 10000)
Calculates the number of points to scatter based on density and area. Caps at maxPoints to prevent engine freezing.
Parameters
bounds: Bounds to scatter indensity: Points per square metermaxPoints: Maximum points to cap at (default 10000) Default: 10000
Returns
Number of points to generate
protected virtual System.Collections.Generic.List`1<Sandbox.Clutter.ClutterInstance> Generate(BBox bounds, Sandbox.Clutter.ClutterDefinition clutter, Sandbox.Scene scene = null)
Generates clutter instances for the given bounds. The Random property is initialized before this is called.
Parameters
bounds: World-space bounds to scatter withinclutter: The clutter containing objects to scatterscene: Scene to use for tracing (null falls back to Game.ActiveScene) Default: null
Returns
Collection of clutter instances to spawn
public static int GenerateSeed(int baseSeed, int x, int y)
Generates a deterministic seed from tile coordinates and base seed. Use this to create unique seeds for different tiles.
protected static Rotation GetAlignedRotation(Vector3 normal, float yawDegrees)
Creates a rotation aligned to a surface normal with random yaw.
protected Sandbox.Clutter.ClutterEntry GetRandomEntry(Sandbox.Clutter.ClutterDefinition clutter)
Selects a random entry from the clutter based on weights. Returns null if no valid entries exist.
public System.Collections.Generic.List`1<Sandbox.Clutter.ClutterInstance> Scatter(BBox bounds, Sandbox.Clutter.ClutterDefinition clutter, int seed, Sandbox.Scene scene = null)
Public entry point for scattering. Creates Random from seed and calls Generate().
Parameters
bounds: World-space bounds to scatter withinclutter: The clutter containing objects to scatterseed: Seed for deterministic random generationscene: Scene to use for tracing (required in editor mode) Default: null
Returns
Collection of clutter instances to spawn
protected static Sandbox.SceneTraceResult TraceGround(Sandbox.Scene scene, Vector3 position)
Helper to perform a ground trace at a position.
No results match this filter.
Properties
Showing 1 properties
protected System.Random Sandbox.Clutter.Scatterer.Random { get; set; }
No results match this filter.
Metadata
| Field | Value |
|---|---|
| Namespace | Sandbox.Clutter |
| Type | class |
| Assembly | Sandbox.Engine |
| Doc ID | T:Sandbox.Clutter.Scatterer |