Class PhysicsSceneAbstract

Physical representation of a scene, allowing creation of new physical objects in the scene and queries against those objects. Objects created in different scenes cannot physically interact with each other.

Hierarchy

  • FrameworkObject
    • PhysicsScene

Constructors

  • Parameters

    • OptionalisInternalConstructor: boolean

    Returns PhysicsScene

Accessors

Methods

  • Adds a new physics region. Certain physics options require you to set up regions in which physics objects are allowed to be in, and objects outside of these regions will not be handled by physics. You do not need to set up these regions by default.

    Parameters

    Returns number

  • Performs a sweep into the scene using a box and returns the closest found hit, if any.

    Parameters

    • box: Immutable<AABox>

      Box to sweep through the scene.

    • rotation: Immutable<Quaternion>

      Orientation of the box.

    • unitDir: Immutable<Vector3>

      Unit direction towards which to perform the sweep.

    • Optionallayer: number

      Layers to consider for the query. This allows you to ignore certain groups of objects.

    • OptionalmaximumDistance: number

      Maximum distance at which to perform the query. Hits past this distance will not be detected.

    Returns PhysicsQueryHit

    True if something was hit, false otherwise.

  • Performs a sweep into the scene using a box and returns all found hits.

    Parameters

    • box: Immutable<AABox>

      Box to sweep through the scene.

    • rotation: Immutable<Quaternion>

      Orientation of the box.

    • unitDir: Immutable<Vector3>

      Unit direction towards which to perform the sweep.

    • Optionallayer: number

      Layers to consider for the query. This allows you to ignore certain groups of objects.

    • OptionalmaximumDistance: number

      Maximum distance at which to perform the query. Hits past this distance will not be detected.

    Returns PhysicsQueryHit[]

    List of all detected hits.

  • Performs a sweep into the scene using a box and checks if it has hit anything. This can be significantly more efficient than other types of cast* calls.

    Parameters

    • box: Immutable<AABox>

      Box to sweep through the scene.

    • rotation: Immutable<Quaternion>

      Orientation of the box.

    • unitDir: Immutable<Vector3>

      Unit direction towards which to perform the sweep.

    • Optionallayer: number

      Layers to consider for the query. This allows you to ignore certain groups of objects.

    • OptionalmaximumDistance: number

      Maximum distance at which to perform the query. Hits past this distance will not be detected.

    Returns boolean

    True if something was hit, false otherwise.

  • Returns a list of all colliders in the scene that overlap the provided box.

    Parameters

    • box: Immutable<AABox>

      Box to check for overlap.

    • rotation: Immutable<Quaternion>

      Orientation of the box.

    • Optionallayer: number

      Layers to consider for the query. This allows you to ignore certain groups of objects.

    Returns Collider[]

    List of all colliders that overlap the box.

  • Checks if the provided box overlaps any other collider in the scene.

    Parameters

    • box: Immutable<AABox>

      Box to check for overlap.

    • rotation: Immutable<Quaternion>

      Orientation of the box.

    • Optionallayer: number

      Layers to consider for the query. This allows you to ignore certain groups of objects.

    Returns boolean

    True if there is overlap with another object, false otherwise.

  • Performs a sweep into the scene using a capsule and returns the closest found hit, if any.

    Parameters

    • capsule: Immutable<Capsule>

      Capsule to sweep through the scene.

    • rotation: Immutable<Quaternion>

      Orientation of the capsule.

    • unitDir: Immutable<Vector3>

      Unit direction towards which to perform the sweep.

    • Optionallayer: number

      Layers to consider for the query. This allows you to ignore certain groups of objects.

    • OptionalmaximumDistance: number

      Maximum distance at which to perform the query. Hits past this distance will not be detected.

    Returns PhysicsQueryHit

    True if something was hit, false otherwise.

  • Performs a sweep into the scene using a capsule and returns all found hits.

    Parameters

    • capsule: Immutable<Capsule>

      Capsule to sweep through the scene.

    • rotation: Immutable<Quaternion>

      Orientation of the capsule.

    • unitDir: Immutable<Vector3>

      Unit direction towards which to perform the sweep.

    • Optionallayer: number

      Layers to consider for the query. This allows you to ignore certain groups of objects.

    • OptionalmaximumDistance: number

      Maximum distance at which to perform the query. Hits past this distance will not be detected.

    Returns PhysicsQueryHit[]

    List of all detected hits.

  • Performs a sweep into the scene using a capsule and checks if it has hit anything. This can be significantly more efficient than other types of cast* calls.

    Parameters

    • capsule: Immutable<Capsule>

      Capsule to sweep through the scene.

    • rotation: Immutable<Quaternion>

      Orientation of the capsule.

    • unitDir: Immutable<Vector3>

      Unit direction towards which to perform the sweep.

    • Optionallayer: number

      Layers to consider for the query. This allows you to ignore certain groups of objects.

    • OptionalmaximumDistance: number

      Maximum distance at which to perform the query. Hits past this distance will not be detected.

    Returns boolean

    True if something was hit, false otherwise.

  • Returns a list of all colliders in the scene that overlap the provided capsule.

    Parameters

    • capsule: Immutable<Capsule>

      Capsule to check for overlap.

    • rotation: Immutable<Quaternion>

      Orientation of the capsule.

    • Optionallayer: number

      Layers to consider for the query. This allows you to ignore certain groups of objects.

    Returns Collider[]

    List of all colliders that overlap the capsule.

  • Checks if the provided capsule overlaps any other collider in the scene.

    Parameters

    • capsule: Immutable<Capsule>

      Capsule to check for overlap.

    • rotation: Immutable<Quaternion>

      Orientation of the capsule.

    • Optionallayer: number

      Layers to consider for the query. This allows you to ignore certain groups of objects.

    Returns boolean

    True if there is overlap with another object, false otherwise.

  • Removes all physics regions.

    Returns void

  • Performs a sweep into the scene using a convex mesh and returns the closest found hit, if any.

    Parameters

    • mesh: PhysicsMesh | ResourceHandle<PhysicsMesh>

      Mesh to sweep through the scene. Must be convex.

    • position: Immutable<Vector3>

      Starting position of the mesh.

    • rotation: Immutable<Quaternion>

      Orientation of the mesh.

    • unitDir: Immutable<Vector3>

      Unit direction towards which to perform the sweep.

    • Optionallayer: number

      Layers to consider for the query. This allows you to ignore certain groups of objects.

    • OptionalmaximumDistance: number

      Maximum distance at which to perform the query. Hits past this distance will not be detected.

    Returns PhysicsQueryHit

    True if something was hit, false otherwise.

  • Performs a sweep into the scene using a convex mesh and returns all found hits.

    Parameters

    • mesh: PhysicsMesh | ResourceHandle<PhysicsMesh>

      Mesh to sweep through the scene. Must be convex.

    • position: Immutable<Vector3>

      Starting position of the mesh.

    • rotation: Immutable<Quaternion>

      Orientation of the mesh.

    • unitDir: Immutable<Vector3>

      Unit direction towards which to perform the sweep.

    • Optionallayer: number

      Layers to consider for the query. This allows you to ignore certain groups of objects.

    • OptionalmaximumDistance: number

      Maximum distance at which to perform the query. Hits past this distance will not be detected.

    Returns PhysicsQueryHit[]

    List of all detected hits.

  • Performs a sweep into the scene using a convex mesh and checks if it has hit anything. This can be significantly more efficient than other types of cast* calls.

    Parameters

    • mesh: PhysicsMesh | ResourceHandle<PhysicsMesh>

      Mesh to sweep through the scene. Must be convex.

    • position: Immutable<Vector3>

      Starting position of the mesh.

    • rotation: Immutable<Quaternion>

      Orientation of the mesh.

    • unitDir: Immutable<Vector3>

      Unit direction towards which to perform the sweep.

    • Optionallayer: number

      Layers to consider for the query. This allows you to ignore certain groups of objects.

    • OptionalmaximumDistance: number

      Maximum distance at which to perform the query. Hits past this distance will not be detected.

    Returns boolean

    True if something was hit, false otherwise.

  • Returns a list of all colliders in the scene that overlap the provided convex mesh.

    Parameters

    Returns Collider[]

    List of all colliders that overlap the mesh.

  • Checks if the provided convex mesh overlaps any other collider in the scene.

    Parameters

    Returns boolean

    True if there is overlap with another object, false otherwise.

  • Casts a ray into the scene and returns the closest found hit, if any.

    Parameters

    • options: {
          layer?: number;
          maximumDistance?: number;
          ray: Immutable<Ray>;
      } | {
          layer?: number;
          maximumDistance?: number;
          origin: Immutable<Vector3>;
          unitDir: Immutable<Vector3>;
      }

      Options object for the function call.

    Returns PhysicsQueryHit

    True if something was hit, false otherwise.

  • Casts a ray into the scene and returns all found hits.

    Parameters

    • options: {
          layer?: number;
          maximumDistance?: number;
          ray: Immutable<Ray>;
      } | {
          layer?: number;
          maximumDistance?: number;
          origin: Immutable<Vector3>;
          unitDir: Immutable<Vector3>;
      }

      Options object for the function call.

    Returns PhysicsQueryHit[]

    List of all detected hits.

  • Casts a ray into the scene and checks if it has hit anything. This can be significantly more efficient than other types of cast* calls.

    Parameters

    • options: {
          layer?: number;
          maximumDistance?: number;
          ray: Immutable<Ray>;
      } | {
          layer?: number;
          maximumDistance?: number;
          origin: Immutable<Vector3>;
          unitDir: Immutable<Vector3>;
      }

      Options object for the function call.

    Returns boolean

    True if something was hit, false otherwise.

  • Removes a physics region.

    Parameters

    • handle: number

    Returns void

  • Performs a sweep into the scene using a sphere and returns the closest found hit, if any.

    Parameters

    • sphere: Immutable<Sphere>

      Sphere to sweep through the scene.

    • unitDir: Immutable<Vector3>

      Unit direction towards which to perform the sweep.

    • Optionallayer: number

      Layers to consider for the query. This allows you to ignore certain groups of objects.

    • OptionalmaximumDistance: number

      Maximum distance at which to perform the query. Hits past this distance will not be detected.

    Returns PhysicsQueryHit

    True if something was hit, false otherwise.

  • Performs a sweep into the scene using a sphere and returns all found hits.

    Parameters

    • sphere: Immutable<Sphere>

      Sphere to sweep through the scene.

    • unitDir: Immutable<Vector3>

      Unit direction towards which to perform the sweep.

    • Optionallayer: number

      Layers to consider for the query. This allows you to ignore certain groups of objects.

    • OptionalmaximumDistance: number

      Maximum distance at which to perform the query. Hits past this distance will not be detected.

    Returns PhysicsQueryHit[]

    List of all detected hits.

  • Performs a sweep into the scene using a sphere and checks if it has hit anything. This can be significantly more efficient than other types of cast* calls.

    Parameters

    • sphere: Immutable<Sphere>

      Sphere to sweep through the scene.

    • unitDir: Immutable<Vector3>

      Unit direction towards which to perform the sweep.

    • Optionallayer: number

      Layers to consider for the query. This allows you to ignore certain groups of objects.

    • OptionalmaximumDistance: number

      Maximum distance at which to perform the query. Hits past this distance will not be detected.

    Returns boolean

    True if something was hit, false otherwise.

  • Returns a list of all colliders in the scene that overlap the provided sphere.

    Parameters

    • sphere: Immutable<Sphere>

      Sphere to check for overlap.

    • Optionallayer: number

      Layers to consider for the query. This allows you to ignore certain groups of objects.

    Returns Collider[]

    List of all colliders that overlap the sphere.

  • Checks if the provided sphere overlaps any other collider in the scene.

    Parameters

    • sphere: Immutable<Sphere>

      Sphere to check for overlap.

    • Optionallayer: number

      Layers to consider for the query. This allows you to ignore certain groups of objects.

    Returns boolean

    True if there is overlap with another object, false otherwise.