NWH Vehicle Physics 2
Search Results for

    Show / Hide Table of Contents

    Class SkidmarkDestroy

    Manages the lifecycle of skidmark GameObjects, destroying them when they exceed distance or time thresholds.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    SkidmarkDestroy
    Namespace: NWH.VehiclePhysics2.Effects
    Assembly: NWH.VehiclePhysics2.dll
    Syntax
    [RequireComponent(typeof(MeshRenderer))]
    public class SkidmarkDestroy : MonoBehaviour
    Remarks

    Attached to each skidmark section GameObject to automatically clean up old skidmarks based on distance from the vehicle or elapsed time. When triggered, the skidmark fades out over a period before being destroyed to prevent sudden disappearance. Checks conditions periodically (every second) rather than every frame for performance.

    Fields

    destroyFlag

    When set to true, forces the skidmark to fade out and be destroyed on the next check cycle. Used by SkidmarkManager to manually trigger cleanup when exceeding total triangle limits.

    Declaration
    [Tooltip("Set to true to trigger the fade out and destroy even with the next check.")]
    public bool destroyFlag
    Field Value
    Type Description
    bool

    distanceThreshold

    Maximum distance in meters from the target transform before triggering destruction. Skidmark begins fading when this distance is exceeded. Set to 0 to disable distance-based cleanup.

    Declaration
    [Tooltip("Distance at which the GameObject will be destroyed.")]
    public float distanceThreshold
    Field Value
    Type Description
    float

    skidmarkIsBeingUsed

    Indicates whether this skidmark section is still actively receiving new geometry from the generator. While true, destruction checks are skipped. Set to false by the generator when moving to a new section.

    Declaration
    [Tooltip("True if the skidmark is still the currently active skidmark")]
    public bool skidmarkIsBeingUsed
    Field Value
    Type Description
    bool

    targetTransform

    The wheel transform used for distance calculations. Skidmark distance is measured from this transform's position. Typically set to the generating wheel's transform.

    Declaration
    [Tooltip("Transform to which the object belongs to.")]
    public Transform targetTransform
    Field Value
    Type Description
    Transform

    timeThreshold

    Maximum lifetime in seconds before triggering destruction. Skidmark begins fading when this age is exceeded. Set to 0 to disable time-based cleanup.

    Declaration
    [Tooltip("Time after which the GameObject will be destroyed.")]
    public float timeThreshold
    Field Value
    Type Description
    float
    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics