NWH Wheel Controller 3D
Search Results for

    Show / Hide Table of Contents

    Class FrictionBase

    Abstract base class for tire friction implementations in WheelController3D. Handles conversion of wheel slip conditions into tire forces that drive vehicle dynamics. Friction models translate slip velocities and tire loads into forces that affect vehicle movement.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    FrictionBase
    StandardFriction
    Namespace: NWH.WheelController3D
    Assembly: NWH.WheelController.dll
    Syntax
    public abstract class FrictionBase : MonoBehaviour
    Remarks

    Friction implementations calculate longitudinal (forward/backward) and lateral (side-to-side) tire forces based on slip ratios, slip angles, normal load, and tire characteristics defined in FrictionPresets. The system provides StandardFriction as the default curve-based model.

    Forces are calculated every physics frame and applied to the vehicle Rigidbody through WheelControllerManager to ensure proper force accumulation and application order.

    Fields

    | Edit this page View Source

    brokeStaticThisFrame

    Set to true when static friction breaks this physics frame. Used by WheelControllerGroup to coordinate break across all wheels. Reset at the start of each UpdateFriction call.

    Declaration
    [NonSerialized]
    public bool brokeStaticThisFrame
    Field Value
    Type Description
    bool
    | Edit this page View Source

    isStaticActive

    Indicates whether the tire is currently in static friction mode (anchored).

    Declaration
    [NonSerialized]
    public bool isStaticActive
    Field Value
    Type Description
    bool
    | Edit this page View Source

    staticReEntryCooldown

    Frames remaining before static friction can re-engage after being broken.

    Declaration
    [NonSerialized]
    public int staticReEntryCooldown
    Field Value
    Type Description
    int

    Methods

    | Edit this page View Source

    BreakStaticFriction(int, bool)

    Forces the tire to exit static friction mode. Called by WheelControllerGroup when coordinating static friction break across all wheels on a vehicle.

    Declaration
    public virtual void BreakStaticFriction(int cooldownFrames = 0, bool clearFilterHistory = false)
    Parameters
    Type Name Description
    int cooldownFrames

    Substeps to wait before re-entry. 0 = use the friction implementation's configured cooldown (StandardFriction.staticFrictionCooldownFrames).

    bool clearFilterHistory

    If true, also zero the relaxation-filter history so the next dynamic substep starts from a clean baseline. Use for external breaks (vehicle reset, teleport) where the prior _prev force values are no longer meaningful. Cascading breaks from CoordinateStaticFrictionBreak should keep the default (false) so the in-substep seeding done inside ProcessStaticFriction is preserved.

    | Edit this page View Source

    UpdateFriction(WheelController, float)

    Calculates and updates tire friction forces based on current wheel slip and load conditions. Called every physics frame (FixedUpdate) to determine longitudinal and lateral tire forces. Implementation should update wheel.angularVelocity, frictionForceMagnitude, frictionSlip, and frictionForce.

    Declaration
    public abstract void UpdateFriction(WheelController wc, float deltaTime)
    Parameters
    Type Name Description
    WheelController wc

    WheelController instance containing current state: slip data, load, speed, and tire properties

    float deltaTime

    Physics timestep duration in seconds (typically Time.fixedDeltaTime)

    Remarks

    The method should:

    1. Calculate longitudinal slip and forces (acceleration/braking)
    2. Update wheel.angularVelocity based on motor torque, brake torque, and friction
    3. Set wc.frictionForceMagnitude (X=longitudinal, Y=lateral) in Newtons
    4. Set wc.frictionSlip (X=longitudinal, Y=lateral) as normalized values
    5. Calculate wc.counterTorque for powertrain feedback

    Access current state through:

    • wc.frictionSpeed: Contact point velocity (X=forward, Y=sideways)
    • wc.load: Current vertical tire load in Newtons
    • wc.loadRating: Maximum rated tire load
    • wc.activeFrictionPreset: Current friction curve parameters
    • wc.motorTorque/brakeTorque: Applied torques
    • wc.wheel.angularVelocity: Current wheel rotation speed
    • Edit this page
    • View Source
    In this article
    Back to top Copyright © NWH - Vehicle Physics, Aerodynamics, Dynamic Water Physics