Scattererclass
Base class to override if you want to create custom scatterer logic. Provides utility methods for entry selection and common operations.
Constructors1
Showing 1 constructors
protected Scatterer()
No results match this filter.
Methods7
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.
| Parameter | Type | Description |
|---|---|---|
| bounds | BBox | Bounds to scatter in |
| density | float | Points per square meter |
| maxPoints = 10000 | int | Maximum points to cap at (default 10000) |
intNumber of points to generateprotected 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.
| Parameter | Type | Description |
|---|---|---|
| bounds | BBox | World-space bounds to scatter within |
| clutter | ClutterDefinition | The clutter containing objects to scatter |
| scene = null | Scene | Scene to use for tracing (null falls back to Game.ActiveScene) |
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.
| Parameter | Type | Description |
|---|---|---|
| baseSeed | int | — |
| x | int | — |
| y | int | — |
int—protected static Rotation GetAlignedRotation(Vector3 normal, float yawDegrees)
Creates a rotation aligned to a surface normal with random yaw.
| Parameter | Type | Description |
|---|---|---|
| normal | Vector3 | — |
| yawDegrees | float | — |
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.
| Parameter | Type | Description |
|---|---|---|
| clutter | ClutterDefinition | — |
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().
| Parameter | Type | Description |
|---|---|---|
| bounds | BBox | World-space bounds to scatter within |
| clutter | ClutterDefinition | The clutter containing objects to scatter |
| seed | int | Seed for deterministic random generation |
| scene = null | Scene | Scene to use for tracing (required in editor mode) |
protected static Sandbox.SceneTraceResult TraceGround(Sandbox.Scene scene, Vector3 position)
Helper to perform a ground trace at a position.
| Parameter | Type | Description |
|---|---|---|
| scene | Scene | — |
| position | Vector3 | — |
No results match this filter.
Properties1
Showing 1 properties
protected System.Random Sandbox.Clutter.Scatterer.Random { get; set; }
Random—No results match this filter.