menu_bookDocumentation

s&box WheelOverlay: Direction arrow overlay

calendar_today May 12, 2026 schedule ~1 min read person PatrickJr verified 50

WheelOverlay Static Class

WheelOverlay is an internal static class that draws a spinning direction arrow overlay on wheel faces. Used by the Wheel tool to visually indicate the spin direction of wheels.

Type Signature

CSHARP
internal static class WheelOverlay
{
    public static void DrawDirection(Vector3 position, Vector3 spinAxis, Vector3 stableUp, float radius, bool reversed);
}

Methods

DrawDirection(Vector3 position, Vector3 spinAxis, Vector3 stableUp, float radius, bool reversed)

Draws a spinning direction arrow overlay on a wheel face. Parameters:
  • position - Center of the wheel
  • spinAxis - The wheel's spin axis (points outward from the wheel face)
  • stableUp - A stable up reference that doesn't rotate with the wheel
  • radius - Visual radius of the overlay
  • reversed - Whether the spin direction is reversed

Implementation Details

CSHARP
public static void DrawDirection(Vector3 position, Vector3 spinAxis, Vector3 stableUp, float radius, bool reversed)
{
    _material ??= Material.Load("materials/game/wheel_dir.vmat");

    var spinDir = reversed ? -1f : 1f;
    var spin = Rotation.FromAxis(spinAxis, Time.Now * 90f * spinDir);

    var overlayTrans = new Transform(position + spinAxis * 0.5f);
    overlayTrans.Rotation = spin * Rotation.LookAt(stableUp, spinAxis);
    overlayTrans.Scale = radius;
    overlayTrans.Scale.x *= -spinDir;

    Game.ActiveScene.DebugOverlay.Model(Model.Plane, transform: overlayTrans, overlay: true, materialOveride: _material);
}

Notes

  • Internal class (not intended for public API)
  • Uses materials/game/wheel_dir.vmat for the arrow texture
  • Arrow spins at 90 degrees per second
  • Overlay is drawn using DebugOverlay.Model
  • Material is cached on first use
  • Used by WheelEntity for visual feedback
  • Arrow direction flips based on reversed parameter
Was this helpful?