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
    • 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

      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

      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

      Returns void

    • 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

      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

      Returns CastHit[]

      All hits sorted from nearest to farthest

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

      Parameters

      Returns CastHit | null

      The nearest hit or null when nothing is hit

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

      Parameters

      Returns CastHit[]

      All hits sorted from nearest to farthest