dacha
    Preparing search index...

    Class PhysicsAPI

    API that provides methods for performing physics queries such as raycasting and overlap tests.

    Query results are based on the latest prepared physics state. That state is updated during the physics system fixed update step, so direct transform or collider changes made outside physics update are not guaranteed to be reflected immediately in query results.

    Index
    • Parameters

      • handlers: PhysicsAPIHandlers

      Returns PhysicsAPI

    • get gravity(): Vector

      Current gravity vector.

      Returns Vector

    • set gravity(gravity: Vector): void

      Sets the gravity vector.

      Parameters

      • gravity: Vector

        New gravity vector

      Returns void

    • Casts an actor's collider and returns the nearest hit, if any.

      Parameters

      • params: CastActorParams

        Actor cast parameters

      Returns CastHit | null

      The nearest hit or null when nothing is hit

    • Casts an actor's collider and returns all hits sorted by distance.

      Parameters

      • params: CastActorParams

        Actor cast parameters

      Returns CastHit[]

      All hits sorted from nearest to farthest

    • Casts an actor's collider and invokes callback for every hit.

      The hit passed to callback is a single object reused across invocations and is only valid for the duration of the call. Copy any fields you need to keep. Hits are delivered in arbitrary order.

      Parameters

      • params: CastActorParams

        Actor cast parameters

      • callback: CastHitCallback

        Invoked once per hit with a reused hit object

      Returns void

    • Returns all collider intersections for an actor's collider.

      Parameters

      • params: OverlapActorParams

        Actor overlap parameters

      Returns OverlapHit[]

      All overlap hits

    • Invokes callback for every collider intersecting an actor's collider.

      Parameters

      • params: OverlapActorParams

        Actor overlap parameters

      • callback: OverlapHitCallback

        Invoked once per overlap with a reused hit object

      Returns void

    • Invokes callback for every collider intersecting the query shape.

      Parameters

      • params: OverlapParams

        Overlap parameters

      • callback: OverlapHitCallback

        Invoked once per overlap with a reused hit object

      Returns void

    • Returns all collider intersections for the given query shape.

      Parameters

      • params: OverlapParams

        Overlap parameters

      Returns OverlapHit[]

      All overlap hits

    • Casts a ray and returns the nearest hit, if any.

      The ray starts at params.origin, travels in params.direction, and is limited by params.maxDistance.

      Parameters

      • params: RaycastParams

        Raycast parameters

      Returns CastHit | null

      The nearest hit or null when nothing is hit

    • Casts a ray and returns all hits sorted by distance.

      The ray starts at params.origin, travels in params.direction, and is limited by params.maxDistance.

      Parameters

      • params: RaycastParams

        Raycast parameters

      Returns CastHit[]

      All hits sorted from nearest to farthest

    • Casts a ray and invokes callback for every hit.

      Parameters

      • params: RaycastParams

        Raycast parameters

      • callback: CastHitCallback

        Invoked once per hit with a reused hit object

      Returns void

    • Casts a shape and returns the nearest hit, if any.

      Parameters

      • params: ShapeCastParams

        Shape cast parameters

      Returns CastHit | null

      The nearest hit or null when nothing is hit

    • Casts a shape and returns all hits sorted by distance.

      Parameters

      • params: ShapeCastParams

        Shape cast parameters

      Returns CastHit[]

      All hits sorted from nearest to farthest

    • Casts a shape and invokes callback for every hit.

      Parameters

      • params: ShapeCastParams

        Shape cast parameters

      • callback: CastHitCallback

        Invoked once per hit with a reused hit object

      Returns void