Small World Engine API Reference - v0.76.20
    Preparing search index...

    Interface ProximitySensorOptions

    Configuration options for the ProximitySensorBehavior.

    interface ProximitySensorOptions {
        minDistance?: number;
        onUpdate: (factor: number, distance: number, deltaTime: number) => void;
        planar?: boolean;
        radius: number;
        targetObj: CameraInterfaceData | Object3D;
    }
    Index
    minDistance?: number

    The inner distance at which the factor reaches 1.0. Defaults to 0.0.

    onUpdate: (factor: number, distance: number, deltaTime: number) => void

    Callback executed every frame with the normalized proximity factor (0.0 to 1.0).

    planar?: boolean

    Ignore the Y axis when measuring distance (e.g. floor hazards, pickups at a fixed player height). Defaults to false.

    radius: number

    The outer distance at which the factor starts rising above 0.0.

    The target object to measure distance to. Can be an Object3D or a Camera (CameraInterfaceData).