logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class AudioOcclusionDetour

    Pure geometry behind graded occlusion: how much longer a sound has to travel to get around the world bounds of the box that blocks the straight line from the listener to the source, over the top or past either side. Y is up. Engine-free on purpose: only System.Numerics types. A rotated collider's bounds are an axis-aligned box that overestimates the real obstacle, so the detour it reports can be longer than the true one.

    Inheritance
    object
    AudioOcclusionDetour
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.AudioPlayer.Domain.Services
    Assembly: Serenity.AudioPlayer.Domain.dll
    Syntax
    public static class AudioOcclusionDetour

    Fields

    MiddleShare

    Half of anything: the share of a line at its middle, and the share of a length that makes half of it.

    Declaration
    public const float MiddleShare = 0.5
    Field Value
    Type Description
    float

    MinimumHorizontalSeparationMeters

    Declaration
    public const float MinimumHorizontalSeparationMeters = 0.001
    Field Value
    Type Description
    float

    Methods

    ExtraPathAroundBox(Vector3, Vector3, Vector3, Vector3)

    How much longer than the straight line the shortest way around the box is: over the top, or past either side. Positive infinity when the box reaches past an endpoint or its footprint is not crossed, because its bounds then say nothing reliable about a way around it.

    Declaration
    public static float ExtraPathAroundBox(Vector3 listener, Vector3 source, Vector3 boxMin, Vector3 boxMax)
    Parameters
    Type Name Description
    Vector3 listener
    Vector3 source
    Vector3 boxMin
    Vector3 boxMax
    Returns
    Type Description
    float

    IsFootprintCrossedBySegment(Vector3, Vector3, Vector3, Vector3)

    Whether the segment from listener to source (not the infinite ray) crosses the box's footprint seen from above; false for a box beside the segment.

    Declaration
    public static bool IsFootprintCrossedBySegment(Vector3 listener, Vector3 source, Vector3 boxMin, Vector3 boxMax)
    Parameters
    Type Name Description
    Vector3 listener
    Vector3 source
    Vector3 boxMin
    Vector3 boxMax
    Returns
    Type Description
    bool

    ReachesPastAnEndpoint(Vector3, Vector3, Vector3, Vector3)

    Whether the box's footprint, projected without clamping on the horizontal direction from listener to source, starts at or behind the listener or ends at or past the source, or the two are almost on the same vertical: a floor, a ceiling or a very large wall, whose bounds say nothing about the way around it.

    Declaration
    public static bool ReachesPastAnEndpoint(Vector3 listener, Vector3 source, Vector3 boxMin, Vector3 boxMax)
    Parameters
    Type Name Description
    Vector3 listener
    Vector3 source
    Vector3 boxMin
    Vector3 boxMax
    Returns
    Type Description
    bool

    TryGetFallbackDirections(Vector3, Vector3, out Vector3, out Vector3)

    The two directions the fallback paths bend away from the middle of the line: up is world up made perpendicular to the line (world X when the line is vertical) and side is perpendicular to both the line and up. Both signs of side are used, so which way it points does not matter. False, with zero vectors, when the two points coincide.

    Declaration
    public static bool TryGetFallbackDirections(Vector3 listener, Vector3 source, out Vector3 up, out Vector3 side)
    Parameters
    Type Name Description
    Vector3 listener
    Vector3 source
    Vector3 up
    Vector3 side
    Returns
    Type Description
    bool

    UpperChainLength(Span<Vector2>)

    Length of the upper convex chain through the points, from the one with the lowest x to the one with the highest. Reorders the span.

    Declaration
    public static float UpperChainLength(Span<Vector2> points)
    Parameters
    Type Name Description
    Span<Vector2> points
    Returns
    Type Description
    float

    WaypointOffsetForExtraPath(float, float)

    How far from the middle of a straight line of directMeters a waypoint must sit, perpendicular to the line, for the two straight legs through it to be extraPathMeters longer than the line. Zero for no extra path.

    Declaration
    public static float WaypointOffsetForExtraPath(float directMeters, float extraPathMeters)
    Parameters
    Type Name Description
    float directMeters
    float extraPathMeters
    Returns
    Type Description
    float
    In this article
    © 2026 Serenity. All Rights Reserved