Class SkidmarkGenerator
Generates procedural skidmark meshes dynamically as wheels slip on surfaces.
Namespace: NWH.VehiclePhysics2.Effects
Assembly: NWH.VehiclePhysics2.dll
Syntax
public class SkidmarkGenerator
Methods
ApplyOriginShift(Vector3)
Offsets the cached world-space positions by an origin shift, so the next quad spans the wheel's real travel instead of the jump. The mesh itself needs nothing: the skid objects are shifted with the rest of the scene and their vertices are local.
Declaration
public void ApplyOriginShift(Vector3 offset)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | offset | Delta already applied to every root transform. |
FinalizeCurrentSection()
Marks the current section complete so its normal distance/time cleanup can run after this generator retires.
Declaration
public void FinalizeCurrentSection()
GenerateNewSkidmark()
Spawns a new skidmark GameObject with mesh and renderer, and trims the oldest when over the triangle budget.
Declaration
public void GenerateNewSkidmark()
Initialize(SkidmarkManager, WheelComponent)
Binds the generator to its manager and wheel and resets state. The first skidmark object is created on the first grounded tick that reports a valid surface.
Declaration
public void Initialize(SkidmarkManager skidmarkManager, WheelComponent wheelComponent)
Parameters
| Type | Name | Description |
|---|---|---|
| SkidmarkManager | skidmarkManager | Owning skidmark manager supplying settings and the container. |
| WheelComponent | wheelComponent | Wheel this generator tracks. |
Update(int, float, float)
Smooths toward target intensity and appends or commits skidmark geometry for this wheel.
Declaration
public void Update(int surfaceMapIndex, float targetIntensity, float dt)
Parameters
| Type | Name | Description |
|---|---|---|
| int | surfaceMapIndex | Index of the current surface; negative means no skidmark surface. |
| float | targetIntensity | Target skidmark alpha to lerp toward. |
| float | dt | Time step since the last update. |